applicationDidEnterBackgroundメソッドでMKMapView位置情報サービスを停止すると、非常にまれにクラッシュします。(これは、アプリがバックグラウンドにあるときにアプリが位置情報サービスを使用しないようにするためです。)
クラッシュを引き起こすコードは次のようになります。
- (void)MyAppDelegate applicationDidEnterBackground:(UIApplication *app) {
[self.baseAppViewController stopUserTracking];
}
stopUserTrackingメソッドは次のことを行います。
-(void)stopUserTracking {
[baseAppViewController.mapView setUserTrackingMode:MKUserTrackingModeNone];
[baseAppViewController.mapView setShowsUserLocation:NO];
}
baseAppViewControllerがアプリによってリリースされることはないことに注意してください。mapViewもそうではありません。baseAppViewControllerは、そのmapViewのデリゲートです。デリゲートがnilに設定されることはありません。
これがスタックトレースで、MKNormalizedPointForLayerの呼び出しで終了します。MKNormalizedPointForLayerは無効なアノテーションlatlngが原因である可能性があることを他の場所で読みました(http://stackoverflow.com/questions/9766272/error-in-main-thread-mknormalizedpointforlayer)。ただし、これが私のアプリに当てはまるとは思えません。無効なlat / lngsを使用して意図的にアノテーションを追加しようとしましたが、このエラーは発生しません。これがMKTilesRequireGoogleLegalNotices呼び出しの結果として発生しているという事実は興味深いものですが、完全に不可解です。何かご意見は?
Thread 0 Crashed:
0 MapKit 0x32b5de94 MKNormalizedPointForLayer + 28043
1 MapKit 0x32b5dd8f MKNormalizedPointForLayer + 27782
2 MapKit 0x32b5dca3 MKNormalizedPointForLayer + 27546
3 MapKit 0x32b6b901 MKTilesRequireGoogleLegalNotices + 44500
4 MapKit 0x32b69eed MKTilesRequireGoogleLegalNotices + 37824
5 MapKit 0x32b50673 MKTileSupportsTileSetStyle + 15378
6 MyApp 0x00040061 -[BaseAppViewController stopUserTracking] (BaseAppViewController.m:785)
7 MyApp 0x0001e3c9 -[MyAppDelegate applicationDidEnterBackground:] (MyAppDelegate.m:325)
8 UIKit 0x334fd235 -[UIApplication _handleApplicationSuspend:eventInfo:] + 760
9 UIKit 0x3348deff -[UIApplication handleEvent:withNewEvent:] + 2094
10 UIKit 0x3348d567 -[UIApplication sendEvent:] + 54
11 MyApp 0x000fcb41 -[UIApplication(HMCustom) customSendEvent:] + 85
12 UIKit 0x3348cf3b _UIApplicationHandleEvent + 5826
13 GraphicsServices 0x3764c22b PurpleEventCallback + 882
14 CoreFoundation 0x35a2d523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38
15 CoreFoundation 0x35a2d4c5 __CFRunLoopDoSource1 + 140
16 CoreFoundation 0x35a2c313 __CFRunLoopRun + 1370
17 CoreFoundation 0x359af4a5 CFRunLoopRunSpecific + 300
18 CoreFoundation 0x359af36d CFRunLoopRunInMode + 104
19 GraphicsServices 0x3764b439 GSEventRunModal + 136
20 UIKit 0x334bbcd5 UIApplicationMain + 1080
21 MyApp 0x000026d3 main (main.m:27)
Thread 1:
0 libsystem_kernel.dylib 0x362ff3a8 kevent + 24
1 libdispatch.dylib 0x348e9c29 _dispatch_mgr_wakeup + 0
Thread 2:
0 libsystem_kernel.dylib 0x362ff004 mach_msg_trap + 20
1 CoreFoundation 0x35a2d3f3 __CFRunLoopServiceMachPort + 126
2 CoreFoundation 0x35a2c12b __CFRunLoopRun + 882
3 CoreFoundation 0x359af4a5 CFRunLoopRunSpecific + 300
4 CoreFoundation 0x359af36d CFRunLoopRunInMode + 104
5 WebCore 0x318aeca3 _ZL12RunWebThreadPv + 402
6 libsystem_c.dylib 0x32e1c735 _pthread_start + 320
Thread 3:
0 libsystem_kernel.dylib 0x362ff004 mach_msg_trap + 20
1 CoreFoundation 0x35a2d3f3 __CFRunLoopServiceMachPort + 126
2 CoreFoundation 0x35a2c12b __CFRunLoopRun + 882
3 CoreFoundation 0x359af4a5 CFRunLoopRunSpecific + 300
4 CoreFoundation 0x359af36d CFRunLoopRunInMode + 104
5 MyApp 0x00033823 LoggerWorkerThread (LoggerClient.m:494)
6 libsystem_c.dylib 0x32e1c735 _pthread_start + 320
Thread 4:
0 libsystem_kernel.dylib 0x3630f570 __select + 20
1 libsystem_c.dylib 0x32e1c735 _pthread_start + 320
Thread 5:
0 libsystem_kernel.dylib 0x362ff004 mach_msg_trap + 20
1 CoreFoundation 0x35a2d3f3 __CFRunLoopServiceMachPort + 126
2 CoreFoundation 0x35a2c12b __CFRunLoopRun + 882
3 CoreFoundation 0x359af4a5 CFRunLoopRunSpecific + 300
4 CoreFoundation 0x359af36d CFRunLoopRunInMode + 104
5 Foundation 0x354e8bb9 +[NSURLConnection(Loader) _resourceLoadLoop:] + 308
6 Foundation 0x354e8a81 -[NSThread main] + 72
7 Foundation 0x3557c591 __NSThread__main__ + 1048
8 libsystem_c.dylib 0x32e1c735 _pthread_start + 320
Thread 6:
0 libsystem_kernel.dylib 0x362ff004 mach_msg_trap + 20
1 CoreFoundation 0x35a2d3f3 __CFRunLoopServiceMachPort + 126
2 CoreFoundation 0x35a2c12b __CFRunLoopRun + 882
3 CoreFoundation 0x359af4a5 CFRunLoopRunSpecific + 300
4 CoreFoundation 0x359af36d CFRunLoopRunInMode + 104
5 MapKit 0x32b4de1d MKTileSupportsTileSetStyle + 5052
6 Foundation 0x354e8a81 -[NSThread main] + 72
7 Foundation 0x3557c591 __NSThread__main__ + 1048
8 libsystem_c.dylib 0x32e1c735 _pthread_start + 320
Thread 7:
0 libsystem_kernel.dylib 0x362ff004 mach_msg_trap + 20
1 CoreFoundation 0x35a2d3f3 __CFRunLoopServiceMachPort + 126
2 CoreFoundation 0x35a2c12b __CFRunLoopRun + 882
3 CoreFoundation 0x359af4a5 CFRunLoopRunSpecific + 300
4 CoreFoundation 0x359af36d CFRunLoopRunInMode + 104
5 MyApp 0x0007e78b +[ASIHTTPRequest runRequests] + 171
6 Foundation 0x354e8a81 -[NSThread main] + 72
7 Foundation 0x3557c591 __NSThread__main__ + 1048
8 libsystem_c.dylib 0x32e1c735 _pthread_start + 320
Thread 8:
0 libsystem_kernel.dylib 0x362ff004 mach_msg_trap + 20
1 CoreFoundation 0x35a2d3f3 __CFRunLoopServiceMachPort + 126
2 CoreFoundation 0x35a2c12b __CFRunLoopRun + 882
3 CoreFoundation 0x359af4a5 CFRunLoopRunSpecific + 300
4 CoreFoundation 0x359af36d CFRunLoopRunInMode + 104
5 WebCore 0x318d80d9 _ZN7WebCoreL15runLoaderThreadEPv + 128
6 libsystem_c.dylib 0x32e1c735 _pthread_start + 320
Thread 9:
0 libsystem_kernel.dylib 0x3630fcd4 __workq_kernreturn + 8
Thread 10:
0 libsystem_c.dylib 0x32e16cc8 start_wqthread + 0
Thread 11:
0 libsystem_kernel.dylib 0x3630fcd4 __workq_kernreturn + 8
Thread 12:
0 libsystem_kernel.dylib 0x3630fcd4 __workq_kernreturn + 8
Thread 13:
0 libsystem_kernel.dylib 0x3630fcd4 __workq_kernreturn + 8
Thread 14:
0 libsystem_kernel.dylib 0x362ff004 mach_msg_trap + 20
1 CoreFoundation 0x35a2d3f3 __CFRunLoopServiceMachPort + 126
2 CoreFoundation 0x35a2c12b __CFRunLoopRun + 882
3 CoreFoundation 0x359af4a5 CFRunLoopRunSpecific + 300
4 CoreFoundation 0x359af36d CFRunLoopRunInMode + 104
5 Foundation 0x354dcb75 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 256
6 MyApp 0x0011d50d +[FlurryHTTPEater sendMethod:to:body:headerFields:timeoutInterval:useWebView:] (FlurryHTTPEater.m:67)
7 MyApp 0x00126ae9 +[FlurrySession sendSessionsToServerWithTimeout:useWebView:requestAppCircleAds:requestVideoAds:requestAppSpotAds:requestReengageAds:sendCurrentSession:] (FlurrySession.m:1053)
8 MyApp 0x001265c7 +[FlurrySession sendSessionsToServerForAppCircle] (FlurrySession.m:1016)
9 Foundation 0x354e8a81 -[NSThread main] + 72
10 Foundation 0x3557c591 __NSThread__main__ + 1048
11 libsystem_c.dylib 0x32e1c735 _pthread_start + 320
Thread 15:
0 libsystem_kernel.dylib 0x3630fcd4 __workq_kernreturn + 8
Thread 16:
0 libsystem_kernel.dylib 0x3630fcd4 __workq_kernreturn + 8
Thread 17:
0 libsystem_kernel.dylib 0x3630fcd4 __workq_kernreturn + 8
Thread 0 crashed with ARM Thread State:
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x41a00000
r4: 0x003b3520 r5: 0x003b3520 r6: 0xfffffffc r7: 0x2fea761c
r8: 0x3f01fae8 r9: 0x00000000 r10: 0x0eaec170 r11: 0x3f485f10
ip: 0xbff00000 sp: 0x2fea7610 lr: 0x32b548ef pc: 0x32b5de94
cpsr: 0x20080030
Binary Images:
(truncated)