这是我在这里的第一篇文章,所以如果你认为我做错了什么,请告诉我;D
首先,我一直在做研究,但没有成功,我无法弄清楚发生了什么。
我正在开发一个通用应用程序,它在我用来测试它的每台设备(iPhone 3GS、iPhone 4、iPhone 4S、iPad 2 和 iPod Touch 4G)上运行良好。但是一些客户报告说应用程序在启动时关闭(也在不同的型号和 iOS 版本中,所以似乎没有共同因素。我的意思是,应用程序不会只在特定的设备型号/iOS 版本中失败)。
其中一位非常好心,他给了我事故报告员。这似乎是一个常见的 0x8badf00d 问题(我必须以某种方式优化启动,以便 didFinishLaunchingWithOptions 尽快返回,我知道)。重新启动设备,在后台/暂停中关闭其他应用程序,然后它就可以工作了。这是崩溃报告器(我不知道为什么它没有像下面发布的第二个崩溃报告器那样被符号化。我在 Xcode 管理器上导入了它,我有必要的文件来符号化):
Date/Time: 2012-05-15 00:42:19.074 +0200
OS Version: iPhone OS 5.0.1 (9A405)
Report Version: 104
Exception Type: 00000020
Exception Codes: 0x8badf00d
Highlighted Thread: 0
Application Specific Information:
com.myApp.free failed to resume in time
Elapsed total CPU time (seconds): 2.400 (user 2.400, system 0.000), 12% CPU
Elapsed application CPU time (seconds): 0.073, 0% CPU
Last Exception Backtrace:
0 0x3293a8bf + 848537791
1 0x356021e5 + 895492581
2 0x32883b6b + 847788907
3 myApp 0x0000a82d -[PhoneViewController requestFinished:] (PhoneViewController.m:1679)
4 0x3289922b + 847876651
5 myApp 0x0002a0b1 -[ASIHTTPRequest reportFinished] (ASIHTTPRequest.m:2028)
6 0x3289922b + 847876651
7 0x31fc2757 + 838608727
8 0x3290eb03 + 848358147
9 0x3290e365 + 848356197
10 0x3290d075 + 848351349
11 0x328904dd + 847840477
12 0x328903a5 + 847840165
13 0x335a8fcd + 861573069
14 0x36953743 + 915748675
15 myApp 0x000033af main (main.m:27)
16 myApp 0x00003368 0x1000 + 9064
Thread 0:
0 ??? 0x3465c32c 0 + 879084332
1 ??? 0x35e77fe6 0 + 904364006
2 ??? 0x336cbf66 0 + 862764902
3 ??? 0x336c9348 0 + 862753608
4 ??? 0x356022de 0 + 895492830
5 ??? 0x336c93c0 0 + 862753728
6 ??? 0x336c944c 0 + 862753868
7 ??? 0x336ca820 0 + 862758944
8 ??? 0x35602230 0 + 895492656
9 ??? 0x32890540 0 + 847840576
10 ??? 0x328903a0 0 + 847840160
11 ??? 0x335a8fc8 0 + 861573064
12 ??? 0x3695373e 0 + 915748670
13 myApp 0x000033aa main (main.m:27)
14 myApp 0x00003364 0x1000 + 9060
后来我这里的一位朋友带来了一部 iPhone 4,但该应用程序无法正常工作,显然是因为同样的问题。崩溃报告器也显示了 0x8badf00d,但之前的重启“解决方案”不起作用。此外,这两次崩溃之间存在差异:第一次在启动画面显示时在几秒钟内崩溃,而第二次则花费更多时间(我尝试了几次,但仍然比第一次慢)。我插入 iPhone 以查看 Xcode 控制台中发生的情况(在崩溃报告之后发布了一些行)。这里是崩溃记者...
Date/Time: 2012-05-15 11:57:30.227 +0200
OS Version: iPhone OS 5.1 (9B176)
Report Version: 104
Exception Type: 00000020
Exception Codes: 0x8badf00d
Highlighted Thread: 0
Application Specific Information:
com.myApp.free failed to launch in time
Elapsed total CPU time (seconds): 12.410 (user 12.410, system 0.000), 63% CPU
Elapsed application CPU time (seconds): 7.302, 37% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x35069dcc __open + 8
1 DataDetectorsCore 0x30c8ca60 DDmmap + 8
2 DataDetectorsCore 0x30c860ea DDCacheCreateFromFileAtPathWithExtraChecks + 14
3 DataDetectorsCore 0x30c860b8 DDCacheCreateFromSystemCache + 1252
4 DataDetectorsCore 0x30c85a16 DDScannerCreateWithType + 14
5 DataDetectorsCore 0x30c85aaa DDScannerCreate + 6
6 Foundation 0x3118cac8 -[NSDataDetector initWithTypes:error:] + 960
7 Foundation 0x3118c6ec +[NSDataDetector dataDetectorWithTypes:error:] + 44
8 myApp 0x00004c0c -[PhoneViewController getTelfNumbers] (PhoneViewController.m:213)
9 myApp 0x00007062 -[PhoneViewController viewDidLoad] (PhoneViewController.m:864)
10 UIKit 0x32479e3e -[UIViewController awakeFromNib] + 106
11 UIKit 0x3250c2ec -[UINib instantiateWithOwner:options:] + 1236
12 UIKit 0x3247a4ac -[UIViewController _loadViewFromNibNamed:bundle:] + 240
13 UIKit 0x32357dfa -[UIViewController loadView] + 82
14 UIKit 0x322cddb8 -[UIViewController view] + 44
15 UIKit 0x3232d7de -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 86
16 UIKit 0x3232d77c -[UITabBarController transitionFromViewController:toViewController:] + 24
17 UIKit 0x3232d0b6 -[UITabBarController _setSelectedViewController:] + 294
18 UIKit 0x3232cdea -[UITabBarController setSelectedIndex:] + 234
19 myApp 0x00003f1e -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:294)
20 UIKit 0x322cce4c -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1176
21 UIKit 0x322c697e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 402
22 UIKit 0x32294c64 -[UIApplication handleEvent:withNewEvent:] + 1004
23 UIKit 0x32294708 -[UIApplication sendEvent:] + 48
24 UIKit 0x322940dc _UIApplicationHandleEvent + 5820
25 GraphicsServices 0x364c9224 PurpleEventCallback + 876
26 CoreFoundation 0x3524a51c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
27 CoreFoundation 0x3524a4be __CFRunLoopDoSource1 + 134
28 CoreFoundation 0x3524930c __CFRunLoopRun + 1364
29 CoreFoundation 0x351cc49e CFRunLoopRunSpecific + 294
30 CoreFoundation 0x351cc366 CFRunLoopRunInMode + 98
31 UIKit 0x322c5a0c -[UIApplication _run] + 544
32 UIKit 0x322c2e76 UIApplicationMain + 1074
33 myApp 0x000033a8 main (main.m:27)
34 myApp 0x00003360 0x1000 + 9056
...这里是控制台上抛出的行:
2012-05-16 10:52:26.440 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.444 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.466 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.470 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.485 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.490 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.509 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.514 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.529 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.533 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.548 myApp[315:707] DDCache: mmap failed with error 12
[...]
(always the same two lines)
我不知道现在该做什么。大部分设备启动应用程序没有问题,另一部分设备在重启/关闭某些应用程序后消失了“吃坏食物”,还有一些设备(到目前为止,客户的一个和一个我们的设备)可以即使重新启动/关闭应用程序也不要启动它。
正如我之前所说,似乎没有 iOS 特定设备/型号或 iOS 版本的情况。更奇怪的是,Apple 验证了我的应用程序并且他们没有报告任何崩溃或错误。好吧,事实上他们做到了,他们拒绝了我上传的第一个二进制文件,因为我没有 Info.plist,所以它在调试时可以工作,但在作为最终应用程序运行时却没有。这是固定的,但我让你知道以防万一。
任何想法?
先感谢您!
PS:我不是以英语为母语的人,所以如果有什么奇怪的地方你不明白,请不要犹豫,我会尝试用其他词再次解释。