Google Plus SDK回调分享
Google Plus SDK Call back for share
我已经为 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>
设置为您的视图控制器。之后在你的 - (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
。
我已经为 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>
设置为您的视图控制器。之后在你的 - (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
。