ios - Receive and respond to EKEventStoreChangedNotification in the background? -


i wondering if in ios7, new api's possible respond notification in background, in case, have following observer:

[[nsnotificationcenter defaultcenter] addobserver:self                                          selector:@selector(storechanged:)                                              name:ekeventstorechangednotification                                            object:eventstore]; 

i receiving notification need run app selector gets called. i've browsed through response , it's not possible not sure if referring ios7 specifically.

any thoughts?

thanks!

the ekeventstorechangednotification fire when app comes foreground. if want call storechanged: method in background, , having ui updated on coming foreground again, need add background fetch capability app.

<key>uibackgroundmodes</key> <array>     <string>fetch</string> </array> 

in app delegate didfinishlaunchingwithoptions method add line

[application setminimumbackgroundfetchinterval:uiapplicationbackgroundfetchintervalminimum]; 

this ensures app calls background fetch, default interval never. minimum key key ensures ios handles when call background fetch method. can set own minimum interval if don't want fire possible.

finally implement background fetch method in app delegate:

- (void)application:(uiapplication *)application performfetchwithcompletionhandler:(void (^)(uibackgroundfetchresult))completionhandler {  [self storechanged:nil];  completionhandler(uibackgroundfetchresultnewdata); } 

you can test in xcode while debugging debug > simulate background fetch.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -