我的应用需要访问设备上的日历数据库。对于 ios6,我在应用程序首次运行时请求许可,如果允许,一切正常。但是,如果应用程序在后台并且用户关闭应用程序的权限,我的代码会崩溃并跳转到主循环并在以下位置停止:
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
任何想法如何解决这个问题。
感谢
礼萨
进一步补充:
这是崩溃的堆栈跟踪
Thread 1, Queue : com.apple.main-thread
#0 0x33269eb4 in mach_msg_trap ()
#1 0x3326a04c in mach_msg ()
#2 0x3525a6c6 in _GSSendEvent ()
#3 0x35259510 in GSSendEvent ()
#4 0x370e9f28 in _sendPendingApplicationSuspendEvent ()
#5 0x370e34aa in _UIApplicationHandleEvent ()
#6 0x3525b5a2 in _PurpleEventCallback ()
#7 0x3525b1d2 in PurpleEventCallback ()
#8 0x34580172 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#9 0x34580116 in __CFRunLoopDoSource1 ()
#10 0x3457ef98 in __CFRunLoopRun ()
#11 0x344f1ebc in CFRunLoopRunSpecific ()
#12 0x344f1d48 in CFRunLoopRunInMode ()
#13 0x3525a2ea in GSEventRunModal ()
#14 0x37137300 in UIApplicationMain ()
#15 0x000aede4 in main at /Users/..../appName/main.m:16
Thread 3, Queue : com.apple.libdispatch-manager
#0 0x3326a648 in kevent64 ()
#1 0x389934f0 in _dispatch_mgr_invoke ()
#2 0x38985df8 in _dispatch_mgr_thread$VARIANT$up ()
Thread 4, Queue : (null)
#0 0x3327ad98 in __workq_kernreturn ()
#1 0x3862ccfa in _pthread_workq_return ()
#2 0x3862ca16 in _pthread_wqthread ()
#3 0x3862c8a4 in start_wqthread ()
Thread 5 WebThread, Queue : (null)
#0 0x33269eb4 in mach_msg_trap ()
#1 0x3326a04c in mach_msg ()
#2 0x34580044 in __CFRunLoopServiceMachPort ()
#3 0x3457eda2 in __CFRunLoopRun ()
#4 0x344f1ebc in CFRunLoopRunSpecific ()
#5 0x344f1d48 in CFRunLoopRunInMode ()
#6 0x352d5a74 in RunWebThread(void*) ()
#7 0x38637310 in _pthread_start ()
#8 0x386371d8 in thread_start ()
Thread 9, Queue : (null)
#0 0x3327ad98 in __workq_kernreturn ()
#1 0x3862ccfa in _pthread_workq_return ()
#2 0x3862ca16 in _pthread_wqthread ()
#3 0x3862c8a4 in start_wqthread ()
Thread 10, Queue : (null)
#0 0x3327ad98 in __workq_kernreturn ()
#1 0x3862ccfa in _pthread_workq_return ()
#2 0x3862ca16 in _pthread_wqthread ()
#3 0x3862c8a4 in start_wqthread ()