I have two applications that share an app group
@"group.edu.tds.poc.shared"
Using NSUserDefaults of this app group, I am able to exchange data between the reader app and the writer app.
The Writer App writes data to the NSUserDefault
NSUserDefaults *sharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.edu.tds.poc.shared"]; [share
dDefaults setObject:stringToStore forKey:key];
[sharedDefaults synchronize];
The Reader App reads the data from the NSUserDefault
NSUserDefaults *sharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.edu.tds.poc.shared"];
return [sharedDefaults stringForKey:@"key"];
I now want the reader app to be notified as soon as the writer app modifies the value for the key. I.e. Can I notify the reader app when the writer app is running in the foreground (Reader app is either running in the background or is not running).
I have implemented the marked solution but with no luck:
Call back only when the Reader App is in foreground state. (Wrote to the Shared Defaults using Reader app)
Any idea if this can be achieved?