iPad应用程序崩溃在苹果审查 - 无法在模拟器中复制,有崩溃日志

问题描述:

我很明显错过了在这里明显的东西,真的很感激一些输入。我曾多次尝试向苹果公司(本例中为iPad)提交应用程序,测试时它们正在崩溃,但我无法复制我的情况(显然,我只有该死的模拟器才能在此处使用)。iPad应用程序崩溃在苹果审查 - 无法在模拟器中复制,有崩溃日志

崩溃日志如下:

Date/Time:  2010-04-01 05:39:47.226 -0700 
OS Version:  iPhone OS 3.2 (7B367) 
Report Version: 104 

Exception Type: EXC_CRASH (SIGABRT) 
Exception Codes: 0x00000000, 0x00000000 
Crashed Thread: 0 

Thread 0 Crashed: 
0 libSystem.B.dylib    0x000790a0 __kill + 8 
1 libSystem.B.dylib    0x00079090 kill + 4 
2 libSystem.B.dylib    0x00079082 raise + 10 
3 libSystem.B.dylib    0x0008d20a abort + 50 
4 libstdc++.6.dylib    0x00044a1c __gnu_cxx::__verbose_terminate_handler() + 376 
5 libobjc.A.dylib     0x000057c4 _objc_terminate + 104 
6 libstdc++.6.dylib    0x00042dee __cxxabiv1::__terminate(void (*)()) + 46 
7 libstdc++.6.dylib    0x00042e42 std::terminate() + 10 
8 libstdc++.6.dylib    0x00042f12 __cxa_throw + 78 
9 libobjc.A.dylib     0x000046a4 objc_exception_throw + 64 
10 CoreFoundation     0x00090c6e +[NSException raise:format:arguments:] + 74 
11 CoreFoundation     0x00090d38 +[NSException raise:format:] + 28 
12 Foundation      0x00002600 -[NSCFDictionary setObject:forKey:] + 184 
13 iPadMosaic      0x00003282 -[iPadMosaicViewController getAlbumThumbs] (iPadMosaicViewController.m:468) 
14 Foundation      0x000728fe __NSFireDelayedPerform + 314 
15 CoreFoundation     0x00022d1c CFRunLoopRunSpecific + 2092 
16 CoreFoundation     0x000224da CFRunLoopRunInMode + 42 
17 GraphicsServices    0x000030d4 GSEventRunModal + 108 
18 GraphicsServices    0x00003180 GSEventRun + 56 
19 UIKit       0x000034c2 -[UIApplication _run] + 374 
20 UIKit       0x000019ec UIApplicationMain + 636 
21 iPadMosaic      0x00002234 main (main.m:14) 
22 iPadMosaic      0x00002204 start + 32 

我在这里的理解是,我搞坏的字典添加莫名其妙。的代码中的相关行是:

for (NSDictionary *album in self.albumList) { 
    // Get image for each album cover 

    UIImage *albumCover; 

    // Loop through photos to get URL of cover based on photo ID match 
    NSString *coverURL = @""; 
    for (NSDictionary *photo in self.photoList) { 
     if ([[photo objectForKey:@"pid"] isEqualToString:[album objectForKey:@"cover_pid"]]) { 
      coverURL = [photo objectForKey:@"src"]; 
     } 
    } 


    NSURL *albumCoverURL = [NSURL URLWithString:coverURL]; 
    NSData *albumCoverData = [NSData dataWithContentsOfURL:albumCoverURL]; 
    albumCover = [UIImage imageWithData:albumCoverData];  

    if (albumCover == nil || albumCover == NULL) { 
     //NSLog(@"No album cover for some reason"); 
     albumCover = [UIImage imageNamed:@"noImage.png"]; 
    } 

    [[self.albumList objectAtIndex:albumCurrent] setObject:albumCover forKey:@"coverThumb"]; 
} 

这是一个运行在存储在数组中的现有的字典一回路的一部分。如果检索专辑封面由于某种原因失败,则该对象将填充默认图像,然后添加。代码的最后一行是崩溃日志中显示的内容。

它在模拟器中运行良好,但在设备上的测试显然崩溃100%。谁能告诉我我在这里失踪了什么?

如果基础不从根本上,从3.0到3.2改变了,那么就只有的3个例临床异常在-setObject:forKey:提出:

  1. 变异方法发送到不可变对象
  2. 试图插入空值
  3. 尝试插入无钥匙

显然第三的情况下是不可能的,所以你只需要检查:

  1. [self.albumList objectAtIndex:albumCurrent]保证是一个NSMutableDictionary?
  2. 你忘了在提交中包含noImage.png吗?
+0

图像文件位于Resources文件夹中。我现在想知道第一个选项。我从Web请求中获取结果并将其存储在NSMutableArray中。我收到的数组中的字典是否有可能以某种方式不可变? 我是否需要详细地遍历结果并从头开始构建可变的新数组/字典? 这将工作在模拟器,而不是在设备?当我在试图添加对象之前和之后将有问题的字典转储到NSLog时,它在模拟器中看起来很棒。 UIImage对象就是这个键。 – Mike 2010-04-01 15:38:36

+1

*我收到的数组中的字典有可能以某种方式不可变吗?* - 取决于库的写法。制作一个'-mutableCopy'来确保它是可变的。 – kennytm 2010-04-01 15:48:57

我有同样的问题!这是一个大小写敏感的问题...确保名为noImage.png的文件与实际文件匹配...不是NoImage.png或noimage.png ...检查所有图像!由于1个文件中的1个字母,我错过了应用商店的开放!