Peter Warbo Peter Warbo - 1 year ago 95
iOS Question

iOS – Event Kit programming listen to notifications

I want to observe changes to the Calendar application so I register for the

notification. But do I need to have an
object "alive" for me to receive this notification? I'm thinking I'm initializing the
object in on view controller to retrieve some events. And then I will pop this view controller of the navigation stack and the view controller will be deallocated thus the
object will be deallocated.

Answer Source

No, you don't need to keep the EKEventStore object alive as you are already registering EKEventStoreChangedNotification using EKEventStore object named eventStore

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(storeChanged:)
                              name:EKEventStoreChangedNotification  object:eventStore];

Refer this for more clearance of your doubt

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download