Responding to EKEventStoreChangedNotification
I'm trying to listen for EKEventStoreChangedNotification to check if the calendar is changed while my app is in background.
I register the observer in a view controller's initWithNibMethod like this:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(calendarChanged:) name:EKEventStoreChangedNotification object:nil];
The calendarChanged method just logs a message on the console to check if it's called.
Problem is my observer method never gets called (the observer object is still valid). From what I understand, unless an app is reg开发者_开发技巧istered to do background execution (my app is not set up for this) the notifications of that type should be coalesced and delivered on entering foreground.
I think the "object:" needs to set with the EventStore object you're using.
Yes, you won't get called whilst you're in the background but your "calendarChanged:" selector will be called when your app' comes in to foreground.
精彩评论