ios - Google Plus SDK 回调分享

标签 ios google-plus

我已经为 ios 集成了 Google Plus SDK 并设置了所有内容以供共享。但是在打开共享显示弹出窗口然后用户共享或取消共享之后是否有回调。我想知道它所说的委托(delegate)方法。 我知道 -(void)finishedSharingWithError:(NSError *)error 是委托(delegate)方法,但它没有被调用。 这是我通过 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>首先到你的 View Controller 。在那之后设置 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/

相关文章:

android - 实现 Base 64 和 SHA

ios - Firebase 数据库观察速度慢

ios - 缩放按钮以适合背景图像

jquery - 基于网络的移动应用程序的 +1/喜欢/分享按钮

ios - 从重复使用的自定义单元格中的按钮传递数据

ios - Apache Cordova 与 Swift 的兼容性如何?

google-plus - 在我的网站上托管 Google Plus 社区

android - 无法从 FirebaseUser.getProviderData() 检索电子邮件

javascript - 使用 javascript 为 google+ 链接设置文本

android - 谷歌加一个air native extension failed resolving interface