MetaWatchOpenProjects / MWM-for-iOS-Gen1

iOS application project that demonstrates connectivity with Meta Watch Bluetooth 4.0 capable watches
Apache License 2.0
72 stars 24 forks source link

Queued EKEventStoreChangedNotification notifications by using a timer to avoid crashes when events are deleted. #7

Closed slprice closed 12 years ago

slprice commented 12 years ago

Issue: Deleting the next event (in my case an iCloud calendar synced from my Mac) would cause the MWM app to crash almost every time.

Possible Cause: The event deletion causes several EKEventStoreChangedNotification notifications to fire rapidly, and while handling the first notification the event may still be changing, leading to the crash. That is my theory.

Resolution: Using a timer to delay handling the notification, effectively queuing multiple repeated notifications, eliminated the crashes in my testing. This will also reduce the amount of processing to handle event changes.

metawatchclient commented 12 years ago

actually, NSTimer is not used anymore, because it does not give correct time when app stays in the background after a long period of time.