我已经为iOS集成了Google Plus SDK,并设置了所有内容以进行共享。但是在共享显示弹出窗口打开并且用户共享或取消共享之后,是否存在回调。我想知道委托方法在哪里这样说。
我知道-(void)finishedSharingWithError:(NSError *)error是委托方法,但是没有被调用。
这是我通过Google Plus分享的代码。

  -(void)postToGooglePlus:(PostModel *)parameter{

GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
signIn.clientID = kClientId;
signIn.scopes = @[ kGTLAuthScopePlusLogin ];
signIn.delegate = self;
[signIn authenticate];
}


- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth
               error: (NSError *) error {
NSLog(@"Received error %@ and auth object %@",error, auth);


id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];

[shareBuilder setPrefillText:@"This is a test"];
[shareBuilder open];

}

-(void)finishedSharingWithError:(NSError *)error{
    if(!error){
   }
 }

最佳答案

您必须首先将<GPPShareDelegate>设置为视图控制器。之后,在delegate方法中像这样设置- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth error: (NSError *) error:

id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
[GPPShare sharedInstance].delegate = self;

现在,您将能够相应地调用-(void)finishedSharingWithError:(NSError *)error-(void)finishedSharing:(BOOL)shared

关于ios - Google Plus SDK回叫分享,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32604714/

10-12 17:38