EKEventstore crash when accessed from different controllers
I'm new here but I've been reading along a lot. Mostely I found what I was looking for but now I'm stuck. Reading documentation and asking google didn't help so here I go:
I have an app that adds events to the user's calendar using EKEventstore. I used to do this all from one single view controller, including the function to pick one of the user's calendars. I've been creating eventstores several times in the code, and everything worked fine.
Now I've upgraded my app to some more professional coding, including several view controllers. One is handling the calendar picker (simple table view listing all calendars), another one does the creation and saving of new events to the calendar.
The EKEvenstore is declared in the appdelegate.h
EKEventStore *es;
Each view controller defines the evenststore in it's viewWillAppear method:
es=[[EKEventStore alloc]init];
Everything works fine, I can load and safe events from and to the eventstore, but as soon as I switch to the calendar picker view controller (just loading it up), and then going back to the view controller that creates events, the app crashes. After a new launch I everything is fine again. Any Idea is highly appreciated.
Here's my stack after the exception throw:
2011-08-25 15:35:18.795 Dutysheet Wx[13864:707] -[UINavigationButton refresh]: unrecognized selector sent to instance 0x688f0a0 2011-08-25 15:35:18.822 Dutysheet Wx[13864:707] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationButton refresh]: unrecognized selector sent to instance 0x688f0a0' * Call stack at first throw: ( 0 CoreFoundation 0x30b1364f exceptionPreprocess + 114 1 libobjc.A.dylib 0x3462ec5d objc_exception_throw + 24 2 CoreFoundation 0x30b171bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102 3 CoreFoundation 0x30b16649 __forwarding + 508 4 CoreFoundation 0x30a8d180 _CF_forwarding_prep_0 + 48 5 EventKit 0x339bfe1b -[EKEventStore _databaseChangedExternally] + 682 6 EventKit 0x339bf49f DatabaseChanged + 18 7 CoreFoundation 0x30ae2d69 CFNotificationCenterDarwinCallBack + 24 8 CoreFoundation 0x30adfbdf __CFMachPortPerform + 210 9 CoreFoundation 0x30aeaa97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 26 10 CoreFoundation 0x30aec83f __CFRunLoopDoSource1 + 166 11 CoreFoundation 0x30aed60d __CFRunLoopRun + 520 12 CoreFoundation 0x30a7dec3 CFRunLoopRunSpecific + 230 13 CoreFoundation 0x30a7ddcb CFRunLoopRunInMode + 58 14 GraphicsServices 0x303fc41f GSEventRunModal + 114 15 GraphicsServices 0x3开发者_StackOverflow03fc4cb GSEventRun + 62 16 UIKit 0x30ba3d69 -[UIApplication _run] + 404 17 UIKit 0x30ba1807 UIApplicationMain + 670 18 Dutysheet Wx 0x00002a83 main + 82 19 Dutysheet Wx 0x000029f8 start + 52 ) terminate called after throwing an instance of 'NSException'
精彩评论