One of my class named Message.m is posting a notification with an object sentObject
as below
NSDictionary *sentObject = [NSDictionary dictionaryWithObjectsAndKeys:draftData.arr,@"data", nil];
//Post notification to inform a receiver to reload data
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadDuringSave" object:self userInfo:sentObject];
DraftData.m will be be the receiver to catch the notification as follow
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(dataReloaded:)
name:@"reloadDuringSave"
object:nil];
For posting notification, userInfo
can be nil
or can be an object
(like sentObject
as type of NSDictionary
in this example).
===> Question : what are other params for object
in addObserver
method. Can it be other than nil and what are they..