Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone ShareKit 2.0:如何获取Sharer授权通知?_Iphone_Objective C_Sharekit - Fatal编程技术网

Iphone ShareKit 2.0:如何获取Sharer授权通知?

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

我需要知道一个共享者何时被授权(更改一些UI),并且看起来有一个SharerDelegate sharerAuthDidFinish方法(我认为)是我实现的,但没有被调用

有人吗


谢谢

在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
}

非常感谢。像冠军一样工作!