reza23
reza23

Reputation: 3375

Crash when requestAccessToEntityType for Calendars gets deactivated when app is in background

My app needs to access the calendar Database on the device. For ios6 I ask for permission when the app first runs and if allowed everything works fine. However if the app is in the background and the user goes and switches off permission for the app, my code crashes and by jumping to the main loop and stopping at:

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

Any ideas how to resolve this.

With thanks

Reza

Further additions:

Here is the stack trace for the crash

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 ()

Upvotes: 1

Views: 392

Answers (1)

user1264176
user1264176

Reputation: 1128

I have the same issue if I'm in debug process when I change corresponding setting.

Although I think since we receive SIGKILL(not SIGABRT) it means that this is expected behaviour.

Basically something changed in OS and all apps that are dependant on the change should be restarted. At least I see it that way.

Upvotes: 2

Related Questions