Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy will EKEventStore hang on indefinitely while saving events?
    primarykey
    data
    text
    <p>I am trying to create an event and store it in the default calendar using this common piece of code:</p> <pre><code>EKEventStore *eventDB = [[EKEventStore alloc] init]; EKEvent *myEvent = [EKEvent eventWithEventStore:eventDB]; myEvent.title = titolo; myEvent.startDate = [NSDate date]; myEvent.calendar = [eventDB defaultCalendarForNewEvents]; myEvent.endDate = data; myEvent.allDay = NO; myEvent.notes = note; NSMutableArray *myAlarmsArray = [[NSMutableArray alloc] init]; EKAlarm *alarm1 = [EKAlarm alarmWithRelativeOffset:-300]; // 5 minutes EKAlarm *alarm2 = [EKAlarm alarmWithRelativeOffset:-3600]; // 1 hour EKAlarm *alarm3 = [EKAlarm alarmWithRelativeOffset:-86400]; // 1 day [myAlarmsArray addObject:alarm1]; [myAlarmsArray addObject:alarm2]; [myAlarmsArray addObject:alarm3]; myEvent.alarms = myAlarmsArray; [myAlarmsArray release]; NSError *err; [eventDB saveEvent:myEvent span:EKSpanThisEvent error:&amp;err]; if (err == noErr) { return YES; } else { [Utils logError:err]; return NO; } </code></pre> <p>It gives not a single problem in the simulator, but when running it on the physical device this will hang on indefinitely when I call <code>[eventDB saveEvent:span:error:]</code>. I tested in the simulator with iOS 4.2/4.3 and iOS 5.0.1, and on the real device I have iOS 5.0.1 installed.</p> <p>What am I doing wrong here? Is it my fault or did I misconfigured the app somewhere?</p> <p>Thank you.</p> <p><strong>Update</strong></p> <p>Here is the stack trace of the call when I pause the app via Xcode:</p> <pre><code>#0 0x3622a060 in semaphore_wait_trap () #1 0x36f55450 in _dispatch_thread_semaphore_wait$VARIANT$up () #2 0x36f536b4 in _dispatch_barrier_sync_f_slow () #3 0x36f53632 in dispatch_barrier_sync_f$VARIANT$up () #4 0x36f5328e in dispatch_sync_f$VARIANT$up () #5 0x36f53910 in dispatch_sync$VARIANT$up () #6 0x31b46628 in -[EKEventStore _deleteObject:] () #7 0x31b48f28 in -[EKPersistentObject primitiveRemoveRelatedObject:forKey:] () #8 0x31b43972 in -[EKPersistentEvent _adjustForNewCalendar] () #9 0x31b43490 in -[EKPersistentEvent validate:] () #10 0x31b708a2 in __23-[EKEventStore commit:]_block_invoke_0 () #11 0x36f537ea in _dispatch_barrier_sync_f_invoke () #12 0x36f5365a in dispatch_barrier_sync_f$VARIANT$up () #13 0x36f5328e in dispatch_sync_f$VARIANT$up () #14 0x36f53910 in dispatch_sync$VARIANT$up () #15 0x31b43200 in -[EKEventStore commit:] () #16 0x31b3f254 in -[EKEventStore saveEvent:span:commit:error:] () #17 0x31b3f11a in -[EKEventStore saveEvent:span:error:] () #18 0x00009018 in +[Utils creaEventoDaCalendario:note:data:] at /myPrivatePath/Utils.m:123 #19 0x0000c144 in -[PotenzialitaController(hidden) salvaEvento] () #20 0x34279434 in -[NSObject performSelector:withObject:withObject:] () #21 0x376e39ea in -[UIApplication sendAction:to:from:forEvent:] () #22 0x377a93ce in -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] () #23 0x34279434 in -[NSObject performSelector:withObject:withObject:] () #24 0x376e39ea in -[UIApplication sendAction:to:from:forEvent:] () #25 0x376e39a6 in -[UIApplication sendAction:toTarget:fromSender:forEvent:] () #26 0x376e3984 in -[UIControl sendAction:to:forEvent:] () #27 0x376e36f4 in -[UIControl(Internal) _sendActionsForEvents:withEvent:] () #28 0x376e402c in -[UIControl touchesEnded:withEvent:] () #29 0x376e250e in -[UIWindow _sendTouchesForEvent:] () #30 0x376e1f00 in -[UIWindow sendEvent:] () #31 0x376c84ec in -[UIApplication sendEvent:] () #32 0x376c7d2c in _UIApplicationHandleEvent () #33 0x30afadf2 in PurpleEventCallback () #34 0x342f3552 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ () #35 0x342f34f4 in __CFRunLoopDoSource1 () #36 0x342f2342 in __CFRunLoopRun () #37 0x342754dc in CFRunLoopRunSpecific () #38 0x342753a4 in CFRunLoopRunInMode () #39 0x30af9fcc in GSEventRunModal () #40 0x376f6742 in UIApplicationMain () #41 0x00002cbc in main at /myPrivatePath/main.m:14 </code></pre> <p>At step <code>#17</code> there is the call that hangs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload