这里是发送通知传值的地方 : 输出打印 memer有值的
DRRRRosterMember* member=[[[DRRRRosterMember alloc]initWithPresence:presence] autorelease];
[self updateMember:member];
[[NSNotificationCenter defaultCenter] postNotificationName:DRRRosterUpdateFriendListNotification object:member];
DLog(@"*********************** member %@ ***********************", member);这里是接受通知 :
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateRosterFriendListNotification:) name:DRRRosterUpdateFriendListNotification object:nil];该方法会执行 不过输出为 ---------****************--------- notification.object (null) ------************************----------
- (void)updateRosterFriendListNotification:(NSNotification *)notification
{ NSLog(@"---------****************--------- notification.object %@ ------************************----------",notification.object);
}不知道怎么回事 望指导
DRRRRosterMember* member=[[[DRRRRosterMember alloc]initWithPresence:presence] autorelease];
[self updateMember:member];
[[NSNotificationCenter defaultCenter] postNotificationName:DRRRosterUpdateFriendListNotification object:member];
DLog(@"*********************** member %@ ***********************", member);这里是接受通知 :
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateRosterFriendListNotification:) name:DRRRosterUpdateFriendListNotification object:nil];该方法会执行 不过输出为 ---------****************--------- notification.object (null) ------************************----------
- (void)updateRosterFriendListNotification:(NSNotification *)notification
{ NSLog(@"---------****************--------- notification.object %@ ------************************----------",notification.object);
}不知道怎么回事 望指导
你在- (void)updateRosterFriendListNotification:(NSNotification *)notification这个方法里打印notification.UserInfo看看有没有你想要的数据
尝试下这里不要autorelease,等通知处理完后,在release对象;
依次类推,看看真正的问题是生命周期管理,还是其它引起的;理论上这样传递参数是不规范的,但是确实是可以的;不释放也没有数据 其他通知事件都是这样写的 有数据的 这样传参数不规范吗 是该userInfo字典传值吗
传的是 member
notification.userInfo[key]取值