Google Plus SDK Call back for share



我已经为ios集成了Google Plus SDK并设置了共享的所有内容。但是是否有一个回调后,共享显示弹出窗口打开,然后用户共享或取消共享。我想知道委托方法在哪里说了这个。我知道-(void)finishedSharingWithError:(NSError *)error是委托功能但它没有被调用。这是我的代码分享通过google + ..

  -(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>设置为视图控制器。之后,在- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth error: (NSError *) error方法中像这样设置delegate:

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

您现在可以相应地调用-(void)finishedSharingWithError:(NSError *)error-(void)finishedSharing:(BOOL)shared

最新更新