我正在开发的应用程序遇到一些奇怪的行为。当我在 Xcode 中测试它时,它工作正常 - 没有错误或警告!它也可以临时分发!提交到 App Store 并没有任何问题获得批准后,我将其下载到我的 iPad 2 上,它运行良好。
但客户告诉我,该应用在第四代 iPad 和 iPad Air 上崩溃了。
我在客户的办公室里用他们的 iPad 4 进行了测试。我从商店删除并再次下载它,什么也没有,它仍然崩溃!然后,我直接在 Xcode 中进行了测试,令我惊讶的是,该应用程序运行时没有出现错误!删除 Xcode 构建版本并从 App Store 再次下载后,它运行没有崩溃。
以下是我从另一台也崩溃的设备中捕获的日志。
有人知道这个问题吗?感谢您提供任何信息!
Incident Identifier: 1E40E435-42BE-448F-AD73-B596B0F24FD7
CrashReporter Key: 199c1d309e448e9f4ec2266b87510c50a18ca49a
Hardware Model: iPad4,2
Process: myapp [3498]
Path: /var/mobile/Applications/7D97FBDC-5EAB-4186-BEE7-5C102A1243F2/myapp.app/myapp
Identifier: com.domain.myapp
Version: 1.1.0 (1.1.0)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2014-08-25 10:40:51.033 -0300
OS Version: iOS 7.1.1 (11D201)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3938f1f0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x393f77b3 pthread_kill + 55
2 libsystem_c.dylib 0x3933fff5 abort + 73
3 myapp 0x000541eb -[AppDelegate persistentStoreCoordinator] (AppDelegate.m:205)
4 myapp 0x00053cdd -[AppDelegate managedObjectContext] (AppDelegate.m:118)
5 myapp 0x0006d70b -[Atualizacao facebookInstallAd] (Atualizacao.m:33)
6 myapp 0x0006ce3f -[StartViewController copyStartFiles] (StartViewController.m:120)
7 Foundation 0x2ebe4113 __NSFireDelayedPerform + 411
8 CoreFoundation 0x2e1cff4d __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 13
9 CoreFoundation 0x2e1cfb67 __CFRunLoopDoTimer + 791
10 CoreFoundation 0x2e1cdeef __CFRunLoopRun + 1215
11 CoreFoundation 0x2e138765 CFRunLoopRunSpecific + 521
12 CoreFoundation 0x2e138547 CFRunLoopRunInMode + 103
13 GraphicsServices 0x3306f6cf GSEventRunModal + 135
14 UIKit 0x30a9788d UIApplicationMain + 1133
15 myapp 0x00051edf main (main.m:16)
16 libdyld.dylib 0x392d8ab5 start + 1
Thread 1:
0 libsystem_kernel.dylib 0x3937c804 kevent64 + 24
1 libdispatch.dylib 0x392cb051 _dispatch_mgr_invoke + 229
2 libdispatch.dylib 0x392c52df _dispatch_mgr_thread + 35
Thread 2:
0 libsystem_kernel.dylib 0x3938fc70 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x393f4c1f _pthread_wqthread + 307
2 libsystem_pthread.dylib 0x393f4ad8 start_wqthread + 4
Thread 3:
0 libsystem_kernel.dylib 0x3938fc70 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x393f4c1f _pthread_wqthread + 307
2 libsystem_pthread.dylib 0x393f4ad8 start_wqthread + 4
Thread 4 name: com.apple.coremedia.player.async
Thread 4:
0 libsystem_kernel.dylib 0x3937caa0 semaphore_wait_trap + 8
1 libdispatch.dylib 0x392c9d3d _dispatch_semaphore_wait_slow + 173
2 MediaToolbox 0x2f6578cb fpa_AsyncMovieControlThread + 1751
3 CoreMedia 0x2e768161 figThreadMain + 193
4 libsystem_pthread.dylib 0x393f6957 _pthread_body + 139
5 libsystem_pthread.dylib 0x393f68c7 _pthread_start + 99
6 libsystem_pthread.dylib 0x393f4ae4 thread_start + 4
Thread 5:
0 libsystem_kernel.dylib 0x3938fc70 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x393f4c1f _pthread_wqthread + 307
2 libsystem_pthread.dylib 0x393f4ad8 start_wqthread + 4
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x00000306
r4: 0x00000006 r5: 0x3b07c18c r6: 0x146826d0 r7: 0x27db7b40
r8: 0x0000000c r9: 0x3b07ce30 r10: 0x1465cba0 r11: 0x1465a680
ip: 0x00000148 sp: 0x27db7b34 lr: 0x393f77b7 pc: 0x3938f1f0
cpsr: 0x00000010
编辑 - 关于“木马”问题
-[AppDelegate persistentStoreCoordinator] (AppDelegate.m:205)
评论如下。
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (_persistentStoreCoordinator != nil) {
return _persistentStoreCoordinator;
}
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent"database.sqlite"];
if (![[NSFileManager defaultManager] fileExistsAtPath:[storeURL path]]) {
NSURL *preloadURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource"databaseStart" ofType"sqlite"]];
NSError* err = nil;
[[NSFileManager defaultManager] copyItemAtURL:preloadURL toURL:storeURL error:&err];
[self addSkipBackupAttributeToItemAtURL:storeURL];
}
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
abort(); // line 205
}
return _persistentStoreCoordinator;
}
“崩溃”是自己造成的,是由于调用 abort()
造成的,只有当活得更久的想法太多而无法考虑时,才应该使用它。
在这种特殊情况下,您正在调用一个 可能 失败(大多数都可以)的方法,您需要更优雅地处理它:
NSLog()
或类似 Cocoa Lumberjack 的日志框架报告返回的错误因为这将帮助您诊断 future 的问题。nil
而不是中止。如果您的应用因此问题而无法继续,您需要将其置于某种“无法继续”窗口内,最好包含相关的错误消息,允许用户选择性地终止应用。 关于ios - 某些 ipad 型号中的 EXC_CRASH (SIGABRT),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25510112/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |