ios - 某些 ipad 型号中的 EXC_CRASH (SIGABRT)
<p><p>我正在开发的应用程序遇到一些奇怪的行为。当我在 Xcode 中测试它时,它工作正常 - 没有错误或警告!它也可以临时分发!提交到 App Store 并没有任何问题获得批准后,我将其下载到我的 iPad 2 上,它运行良好。</p>
<p>但客户告诉我,该应用在第四代 iPad 和 iPad Air 上崩溃了。</p>
<p>我在客户的办公室里用他们的 iPad 4 进行了测试。我从商店删除并再次下载它,什么也没有,它仍然崩溃!然后,我直接在 Xcode 中进行了测试,令我惊讶的是,该应用程序运行时没有出现错误!删除 Xcode 构建版本并从 App Store 再次下载后,它运行<em>没有崩溃</em>。</p>
<p>以下是我从另一台也崩溃的设备中捕获的日志。</p>
<p>有人知道这个问题吗?感谢您提供任何信息!</p>
<pre><code>Incident Identifier: 1E40E435-42BE-448F-AD73-B596B0F24FD7
CrashReporter Key: 199c1d309e448e9f4ec2266b87510c50a18ca49a
Hardware Model: iPad4,2
Process: myapp
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
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.m:205)
4 myapp 0x00053cdd - (AppDelegate.m:118)
5 myapp 0x0006d70b - (Atualizacao.m:33)
6 myapp 0x0006ce3f - (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
10CoreFoundation 0x2e1cdeef __CFRunLoopRun + 1215
11CoreFoundation 0x2e138765 CFRunLoopRunSpecific + 521
12CoreFoundation 0x2e138547 CFRunLoopRunInMode + 103
13GraphicsServices 0x3306f6cf GSEventRunModal + 135
14UIKit 0x30a9788d UIApplicationMain + 1133
15myapp 0x00051edf main (main.m:16)
16libdyld.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
</code></pre>
<p><strong>编辑</strong> - 关于“木马”问题</p>
<p><code>- (AppDelegate.m:205)</code> 评论如下。</p>
<pre><code>- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (_persistentStoreCoordinator != nil) {
return _persistentStoreCoordinator;
}
NSURL *storeURL = [ URLByAppendingPathComponent:@"database.sqlite"];
if (![ fileExistsAtPath:]) {
NSURL *preloadURL = pathForResource:@"databaseStart" ofType:@"sqlite"]];
NSError* err = nil;
[ copyItemAtURL:preloadURL toURL:storeURL error:&err];
;
}
NSError *error = nil;
_persistentStoreCoordinator = [ initWithManagedObjectModel:];
if (!) {
abort(); // line 205
}
return _persistentStoreCoordinator;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>“崩溃”是自己造成的,是由于调用 <code>abort()</code> 造成的,只有当活得更久的想法太多而无法考虑时,才应该使用它。</p >
<p>在这种特殊情况下,您正在调用一个 <em>可能</em> 失败(大多数都可以)的方法,您需要更优雅地处理它:</p>
<ol>
<li>使用 <code>NSLog()</code> 或类似 <a href="https://github.com/CocoaLumberjack/CocoaLumberjack" rel="noreferrer noopener nofollow">Cocoa Lumberjack</a> 的日志框架报告返回的错误因为这将帮助您诊断 future 的问题。</li>
<li>返回 <code>nil</code> 而不是中止。如果您的应用因此问题而无法继续,您需要将其置于某种“无法继续”窗口内,最好包含相关的错误消息,允许用户<em>选择性地</em>终止应用。 </li>
</ol></p>
<p style="font-size: 20px;">关于ios - 某些 ipad 型号中的 EXC_CRASH (SIGABRT),我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/25510112/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/25510112/
</a>
</p>
页:
[1]