OGeek|极客世界-中国程序员成长平台

标题: ios - Google Plus SDK 回调分享 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 10:55
标题: ios - Google Plus SDK 回调分享

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

  -(void)postToGooglePlusPostModel *)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)finishedSharingWithErrorNSError *)error{
    if(!error){
   }
 }



Best Answer-推荐答案


您必须首先将 设置为您的 View Controller 。之后在你的 - (void)finishedWithAuth: (GTMOAuth2Authentication *)auth error: (NSError *) errormethod:

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

您现在可以相应地调用 -(void)finishedSharingWithErrorNSError *)error-(void)finishedSharingBOOL)shared。 p>

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






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4