我正在尝试将我的应用内容分享给Google Plus。为此,我使用了以下代码:
-(IBAction)handleGPlus{
id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];
[shareBuilder setURLToShare:[NSURL URLWithString:@"http://dummy.com"]];
[shareBuilder setTitle:@"Some title" description:@"Some description" thumbnailURL:[NSURL URLWithString:@"http://dummy.com/image"]];
[shareBuilder setContentDeepLinkID:kClientId];
[shareBuilder open];
}
我已经像这样设置了clientID:
static NSString * const kClientId = @"MY_CLIENT_ID";
但是我收到以下错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GPPSignIn|'
*** First throw call stack:
(0x346932a3 0x3c33897f 0x346931c5 0x1d2e33 0x122725 0x365860c5 0x36586077 0x36586055 0x3658590b 0x36585e01 0x364ae5f1 0x3649b801 0x3649b11b 0x3819e5a3 0x3819e1d3 0x34668173 0x34668117 0x34666f99 0x345d9ebd 0x345d9d49 0x3819d2eb 0x364ef301 0xee20d 0xed600)
libc++abi.dylib: terminate called throwing an exception
我也包含了GoogleOpenSource.Framework
和GooglePlus.Framework
文件。
知道我做错了吗?
答案 0 :(得分:12)
因为您没有分配GPPSignIn类的client_id。在您的appdelegate中试用此代码
[GPPSignIn sharedInstance].clientID = @"MY_CLIENT_ID";
[GPPDeepLink setDelegate:self];
[GPPDeepLink readDeepLinkAfterInstall];
然后尝试sharing link以正确的方式实施它。
我希望它可以帮到你。