Google Plus SDK回拨共享

时间:2015-09-16 09:30:32

标签: ios google-plus

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

  -(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){
   }
 }

1 个答案:

答案 0 :(得分:1)

您必须先将<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)sharedcompile 'org.A:A:1.0'