iOS Google Plus集成和共享 [英] iOS Google Plus integration and sharing

查看:71
本文介绍了iOS Google Plus集成和共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的应用程序中的内容共享给Google Plus.为此,我使用了以下代码:

I am trying to share content from my app to Google Plus. To this end, I have used the following code:

-(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:

And I have set up the clientID like so:

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.FrameworkGooglePlus.Framework文件.

知道我在做什么错吗?

推荐答案

因为您没有分配GPPSignIn类的client_ id.在您的appdelegate中尝试此代码

Because you are not assigning client_ id of GPPSignIn class. Try this code in your appdelegate

    [GPPSignIn sharedInstance].clientID = @"MY_CLIENT_ID";
    [GPPDeepLink setDelegate:self];
    [GPPDeepLink readDeepLinkAfterInstall];

然后尝试共享链接,以正确的方式实施.

then try sharing link for implementing it in right way.

希望对您有帮助.

这篇关于iOS Google Plus集成和共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆