Iphone ShareKit 2.0:如何获取Sharer授权通知?
我需要知道一个共享者何时被授权(更改一些UI),并且看起来有一个SharerDelegate sharerAuthDidFinish方法(我认为)是我实现的,但没有被调用 有人吗Iphone ShareKit 2.0:如何获取Sharer授权通知?,iphone,objective-c,sharekit,Iphone,Objective C,Sharekit,我需要知道一个共享者何时被授权(更改一些UI),并且看起来有一个SharerDelegate sharerAuthDidFinish方法(我认为)是我实现的,但没有被调用 有人吗 谢谢 在SHKSharer.m中,有以下代码: - (void)authDidFinish:(BOOL)success { [[NSNotificationCenter defaultCenter] postNotificationName:@"SHKAuthDidFinish" object:self us
谢谢 在SHKSharer.m中,有以下代码:
- (void)authDidFinish:(BOOL)success
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"SHKAuthDidFinish" object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:success] forKey:@"success"]];
if ([self.shareDelegate respondsToSelector:@selector(sharerAuthDidFinish:success:)]) {
[self.shareDelegate sharerAuthDidFinish:self success:success];
}
}
因此,您可以在任何类中侦听通知,如:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sharerAuthorized:) name:@"SHKAuthDidFinish" object:nil];
然后实现如下方法:
- (void)sharerAuthorized:(NSNotification *)notification {
//check for success and type of sharer
//do whatever you need to do once it is authorized
}
非常感谢。像冠军一样工作!