i want to know what the possibilities are with sending a Notification.
Is it possible to send a NSUserDefaults?
I know you can send another viewcontroller.
Like this:
NSUserDefaultsDidChangeNotification is just a notification that is sent out when the defaults are changed. To listen out for it you need this code :
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self
selector:@selector(defaultsChanged:)
name:NSUserDefaultsDidChangeNotification
object:nil];
This will call the method defaultsChanged: when the notification is fired. You need to implement this method like this :
- (void)defaultsChanged:(NSNotification *)notification {
// Get the user defaults
NSUserDefaults *defaults = (NSUserDefaults *)[notification object];
// Do something with it
NSLog(@"%@", [defaults objectForKey:@"nameOfThingIAmInterestedIn"]);
}
Well,
Here is a possibility of sending a dictionary through
NSNotificationCenterusingIn the class where you are posting it:
In the class doing the listening:
EDIT:
But usually while receiving Push Notifications from server you have a method called:
In this method you can get the payload as a
Dictionaryas well