开发者

Responding to EKEventStoreChangedNotification

开发者 https://www.devze.com 2023-01-24 12:08 出处:网络
I\'m trying to listen for EKEventStoreChangedNotification to check if the calendar is changed while my app is in background.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消