The difference between these two scheduled method calls - iOS -
i have seen around few times can't seem find difference between 2 ...
[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(loginviewfetcheduserinfo:) name:fbsdkprofiledidchangenotification object:nil]; - (void)loginviewfetcheduserinfo:(nsnotification *)notification and
[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(loginviewfetcheduserinfo) name:fbsdkprofiledidchangenotification object:nil]; - (void)loginviewfetcheduserinfo i know (void)methodname:(type *)newname can pass in value method don't know difference in 2 above , why first 1 (which used in facebook sdk example) on second one.
the first method passes nsnotification object method. way allows access information notification.
[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(loginviewfetcheduserinfo:) name:fbsdkprofiledidchangenotification nil]; for example, if notification posted userinfo dictionary
nsdictionary *userinfo = @{@"blah" : @"foo"}; [[nsnotificationcenter defaultcenter] postnotificationname:fbsdkprofiledidchangenotification object:self userinfo:userinfo]; and wanted access userinfo in method. can access sender of notification, notification's object.
- (void)loginviewfetcheduserinfo:(nsnotification *)notification { nsdictionary *userinfo = notification.userinfo; nsobject *sender = notification.object; }
Comments
Post a Comment