先看api的文档:
addObserver:selector:name:object:
Adds an entry to the receiver’s dispatch table with an observer, a notification selector and optional criteria: notification name and sender.
Parameters
-
。。。。
。。。。
notificationSender
-
The object whose notifications the observer wants to receive; that is, only notifications sent by this sender are delivered to the observer.
If you pass
nil
, the notification center doesn’t use a notification’s sender to decide whether to deliver it to the observer.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(finishReadNFC:) name:@"NotificationFinishReadNFC" object:self];
发送notification端:
[[NSNotificationCenter defaultCenter] postNotificationName:@"NotificationFinishReadNFC" object:self userInfo:[NSDictionary dictionaryWithObject:item forKey:NotificationKeySaveItem]];
参数放在userinfo里传送,而不是object