iphone - iOS App Error: I screwed up somewhere in date calculation -
my app crashing randomly, can't generate same case occurs in user's devices, here more details crash report:
crash class:
nsinternalinconsistencyexception
function:
-[calendarviewcontroller deleteevent:]
the method implementation this:
-(void) deleteevent: (ekspan ) span :(ekevent *) eventtodelete{ nserror* error = nil; [sharedeventstore removeevent:eventtodelete span:span error:&error]; // refresh ui }
stacktrace:
0 corefoundation 0x33acf2a3 <redacted> + 162 1 libobjc.a.dylib 0x3b7ec97f objc_exception_throw + 30 2 corefoundation 0x33acf15d <redacted> + 0 3 foundation 0x343a4ab7 <redacted> + 90 4 eventkit 0x34208b33 <redacted> + 1642 5 eventkit 0x342084c1 <redacted> + 408 6 eventkit 0x342091f7 <redacted> + 306 7 eventkit 0x341fa199 <redacted> + 144 8 eventkit 0x341fa0ff <redacted> + 30 9 calendar 0x0010acaf -[calendarviewcontroller deleteevent:] + 126 10 calendar 0x0016f585 -[blockalertview dismisswithclickedbuttonindex:animated:] + 196 11 uikit 0x359c20c5 <redacted> + 72 12 uikit 0x359c2077 <redacted> + 30 13 uikit 0x359c2055 <redacted> + 44 14 uikit 0x359c190b <redacted> + 502 15 uikit 0x359c1e01 <redacted> + 488 16 uikit 0x358ea5f1 <redacted> + 524 17 uikit 0x358d7801 <redacted> + 380 18 uikit 0x358d711b <redacted> + 6154 19 graphicsservices 0x375ed5a3 <redacted> + 590 20 graphicsservices 0x375ed1d3 <redacted> + 34 21 corefoundation 0x33aa4173 <redacted> + 34 22 corefoundation 0x33aa4117 <redacted> + 138 23 corefoundation 0x33aa2f99 <redacted> + 1384 24 corefoundation 0x33a15ebd cfrunlooprunspecific + 356 25 corefoundation 0x33a15d49 cfrunloopruninmode + 104 26 graphicsservices 0x375ec2eb gseventrunmodal + 74 27 uikit 0x3592b301 uiapplicationmain + 1120 28 calendar 0x000f9533 main + 66 29 calendar 0x0008a6a8 start + 40
please note use 1 instance of ekeventstore in singleton pattern:
// in separate class static ekeventstore *eventstore = nil; + (ekeventstore *)geteventstoreinstance { if (eventstore == nil){ @synchronized(self){ if (eventstore == nil){ eventstore = [[ekeventstore alloc] init]; } } } return(eventstore); }
any possible reason crash?
it's bug. can crash ipad's calendar app following:
- create event, recurring every day recurringend days in future.
- change location of second occurrence , save future events.
- delete first occurrence , select event. bam!
this not happen, when location change starts occurrence after second or when delete future events chosen. when steps in code, app crashes wounderful "i screwed up..."
a short work around is:
[eventstore removeevent:firstevent span:(firstevent.isdetached ? ekspanfutureevents : desiredspan) commit:yes error:nil];
Comments
Post a Comment