用户必须登录才能使用本机共享框 [英] User must be signed in to use the native share box

查看:68
本文介绍了用户必须登录才能使用本机共享框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用中添加google-plus属性的分享。
我在谷歌网络控制台上注册了客户端应用程序并获得了客户端ID。

I want to add share on google-plus property in my application. I registered client application on google web console and obtained client-id.

在我的viewDidLoad函数中:

In my viewDidLoad function :

- (void)viewDidLoad{

    CGRect  rect = self.view.bounds;
    rect.size.height = rect.size.height - 50;
    _postContentUIWV = [[UIWebView alloc] initWithFrame:rect];
    [_postContentUIWV loadHTMLString:selectedPostCD.content baseURL:nil];
    [self.view addSubview:_postContentUIWV];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];




    GPPSignIn *signIn = [GPPSignIn sharedInstance];
    signIn.shouldFetchGooglePlusUser = YES;
   // signIn.shouldFetchGoogleUserEmail = YES;  // Uncomment to get the user's email

    // You previously set kClientId in the "Initialize the Google+ client" step
    signIn.clientID = kClientID;

    [GPPSignIn sharedInstance].actions = [NSArray arrayWithObjects:
                                          @"http://schemas.google.com/AddActivity",
                                          @"http://schemas.google.com/BuyActivity",
                                          @"http://schemas.google.com/CheckInActivity",
                                          @"http://schemas.google.com/CommentActivity",
                                          @"http://schemas.google.com/CreateActivity",
                                          @"http://schemas.google.com/ListenActivity",
                                          @"http://schemas.google.com/ReserveActivity",
                                          @"http://schemas.google.com/ReviewActivity",
                                          nil];

    // Uncomment one of these two statements for the scope you chose in the previous step
    signIn.scopes = @[ kGTLAuthScopePlusLogin ];  // "https://www.googleapis.com/auth/plus.login" scope
    //signIn.scopes = @[ @"profile" ];            // "profile" scope

    // Optional: declare signIn.actions, see "app activities"
    signIn.delegate = self;


    [signIn trySilentAuthentication];

}

然后在我的onButtonCLick函数中:

Then in my onButtonCLick function:

- (void) googlePlusShareTapped {


    id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
    [shareBuilder setURLToShare:[NSURL URLWithString:@"https://www.shinnxstudios.com"]];
    [shareBuilder setPrefillText:@"This is an awesome G+ Sample to share"];
    // [shareBuilder setTitle:@"Title" description:@"Descp" thumbnailURL:[NSURL URLWithString:@"https://www.fbo.com/imageurl"]];

    [shareBuilder open];
}

但是我收到消息:

 [lvl=3] -[GPPNativeShareBuilderImpl open] User must be signed in to use the native share box.

我从App Store下载了google + app并登录。但每次收到此消息且无法分享谷歌上的任何东西。

I downloaded google+ app from App Store and signed in. But every time I get this message and cannot share anything on google+.

有什么建议吗?

推荐答案

首先删除你的来自模拟器的应用程序然后关闭XCode并通过更改以下代码重新打开并再次运行您的应用程序:

First remove your application from simulator then close XCode and reopen and run your app again by changing with following code:

GPPSignIn *signIn = [GPPSignIn sharedInstance];
    signIn.shouldFetchGooglePlusUser = YES;
    signIn.clientID = kClientId;
    signIn.scopes = @[ kGTLAuthScopePlusLogin ];
    signIn.delegate = self;
    [signIn authenticate];

还要确保你必须添加 GooglePlus.bundle 进入您的申请。

And also make sure that you have to added GooglePlus.bundle in to your application.

这篇关于用户必须登录才能使用本机共享框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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