ios - EKEventStore causes SpringBoard crash -
i build application fetches ekevents calendar (by ekeventstore predicateforeventswithstartdate:enddate:calendars:
) , synchronize app-events calendars (with ekeventstore saveevent:span:commit:error:
).
i use static reference ekeventstore
, make sure ekeventstore
not accessed simultaneously different processes.
the app terminated springboard crash on ios7. here backtrace of crash.
last exception backtrace: 0 corefoundation 0x18625e950 __exceptionpreprocess + 132 1 libobjc.a.dylib 0x1927641fc objc_exception_throw + 60 2 corefoundation 0x18625e810 +[nsexception raise:format:arguments:] + 116 3 foundation 0x186d96db4 -[nsassertionhandler handlefailureinmethod:object:file:linenumber:description:] + 112 4 eventkit 0x186adab84 -[ekeventstore _addfetchedobjectwithid:] + 240 5 eventkit 0x186adaa64 __78-[ekeventstore registerfetchedobjectwithid:withdefaultloadedproperties:inset:]_block_invoke + 96 6 libdispatch.dylib 0x192d3bfd4 _dispatch_client_callout + 16 7 libdispatch.dylib 0x192d41c84 _dispatch_barrier_sync_f_invoke + 48 8 eventkit 0x186ada990 -[ekeventstore registerfetchedobjectwithid:withdefaultloadedproperties:inset:] + 148 9 eventkit 0x186ae1458 __41-[ekpredicatesearch startwithcompletion:]_block_invoke + 796 10 eventkit 0x186ae1050 -[ekdaemonconnection _processreplywithid:data:finished:] + 220 11 eventkit 0x186ae0f5c cadreceivereply + 136 12 eventkit 0x186ae0eac _xreply + 124 13 eventkit 0x186ae0e04 clientcallbacks_server + 100 14 libdispatch.dylib 0x192d3fae8 dispatch_mig_server + 352 15 eventkit 0x186ae0d6c __43-[ekdaemonconnection initwithoptions:path:]_block_invoke16 + 44 16 libdispatch.dylib 0x192d3bfd4 _dispatch_client_callout + 16 17 libdispatch.dylib 0x192d3db90 _dispatch_source_invoke + 500 18 libdispatch.dylib 0x192d430f4 _dispatch_root_queue_drain + 104 19 libdispatch.dylib 0x192d434fc _dispatch_worker_thread2 + 76 20 libsystem_pthread.dylib 0x192ed16bc _pthread_wqthread + 356 21 libsystem_pthread.dylib 0x192ed154c start_wqthread + 4
here code initalizing ekeventstore:
+ (ekeventstore *) sharedstore { static ekeventstore *sharedeventstore; if (sharedeventstore == nil) { sharedeventstore = [[ekeventstore alloc] init]; [sharedeventstore requestaccesstoentitytype: ekentitytypeevent completion:^(bool granted, nserror *error) { }]; [sharedeventstore reset]; } return sharedeventstore; }
code fetch events:
nspredicate *predicate = [[calendarhelper sharedstore] predicateforeventswithstartdate:startdate enddate:enddate calendars:[[showablecalendars copy] autorelease]]; nsarray *result = [[calendarhelper sharedstore] eventsmatchingpredicate:predicate];
and update / create events:
ekevent *event = [[calendarhelper sharedstore] eventwithidentifier:eventid]; if(event != nil) { event.title = title; event.startdate = startdate; event.enddate = enddate; nslog(@"updating..."); nslog(@"+++ %@", event.eventidentifier); [[calendarhelper sharedstore] saveevent:event span:ekspanthisevent commit:commit error:nil]; nslog(@"updated."); } else { nslog(@"no event, no update"); }
any clue?
kindly check ios version.. experienced similar crash when working ios 7.0.2, if not try below code
it seems cause of bug related how many events trying in our app. check on apple's bug report (15424747).
it appears bug introduced when our app predicate on eventstore large range of dates.
here code:
nspredicate *predicate = [self.eventstore predicateforeventswithstartdate:startdate enddate:enddate calendars:nil];
//for sorting used nssortdescriptor
if (!self.masterlistsortdescriptor) { self.masterlistsortdescriptor = [nssortdescriptor sortdescriptorwithkey:@"startdate" ascending:yes]; } nsarray *result = [[self.eventstore eventsmatchingpredicate:predicate] sortedarrayusingdescriptors:@[self.masterlistsortdescriptor]];
Comments
Post a Comment