菜鸟教程小白 发表于 2022-12-12 11:58:51

ios - 如何使用 google-plus-ios-sdk-1.7.1 sdk 登录 google-plus?


                                            <p><p>我正在使用 Google Plus 开发 iPhone 应用程序。</p>

<p>当我尝试登录时,我收到 401 错误。</p>

<p>我使用的是 google-plus-ios-sdk-1.7.1 sdk。</p>

<pre><code>-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

// Override point for customization after application launch.

    .clientID = kClientID;
    // Read Google+ deep-link data.
    ;
    ;   

    return YES;
}
</code></pre>

<p>在<code>shareviewcontroller</code>中:</p>

<pre><code>-(void)viewDidLoad
{
    ;


    GPPSignIn *signIn                   = ;
    signIn.shouldFetchGooglePlusUser    = YES;
    signIn.scopes                     = @[ kGTLAuthScopePlusLogin ];
    signIn.delegate                     = self;   

    [ trySilentAuthentication];

    _shareConfiguration               = ;
    _shareConfiguration.useNativeSharebox = YES;
    //_shareConfiguration.deepLinkEnabled = YES;
    _shareConfiguration.mediaAttachmentEnabled = YES;
}

-(void)btnGoogleShare_Action
{

    if (.authentication) {
      id&lt;GPPShareBuilder&gt; shareBuilder = [ nativeShareDialog];
      [(id&lt;GPPNativeShareBuilder&gt;)shareBuilder attachImage:self.imgView.image];
      [(id&lt;GPPNativeShareBuilder&gt;)shareBuilder setTitle:self.dict[@&#34;title&#34;] description:self.dict[@&#34;comment&#34;] thumbnailURL:nil];
      ;
    }
    else
    {
      AppDelegate *appDelegate = (AppDelegate*).delegate;

      GPPSignInButton *sign = [ init];

      if (floor(NSFoundationVersionNumber) &gt; NSFoundationVersionNumber_iOS_6_1) {

            appDelegate.alert = [ initWithTitle:@&#34;Sign to Google +&#34; message:@&#34;After login to Google+, Please retry again.&#34; delegate:nil cancelButtonTitle:nil otherButtonTitles:@&#34;Cancel&#34;, nil];

            ; //works only in iOS7
      } else {

            appDelegate.alert = [ initWithTitle:@&#34;Sign to Google +&#34; message:@&#34;After login to Google+, Please retry again.\n\n\n&#34; delegate:nil cancelButtonTitle:nil otherButtonTitles:@&#34;Cancel&#34;, nil];

            sign.frame = CGRectMake(70, 85, 100, 40);
            ;
      }


      ;
      ;
    }
}
</code></pre>

<p><br/><br/>
下面是截图,谁能帮帮我?</p>

<hr/>

<p> <img src="/image/yEv2x.png" alt="http://i.stack.imgur.com/yEv2x.png"/> </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>正如评论中提到的,第一个问题已经讨论过 <a href="https://stackoverflow.com/questions/18677244/error-invalid-client-no-application-name" rel="noreferrer noopener nofollow">here</a> .</p>

<p>关于文本和媒体同时发布的第二个问题在 API 文档中提到 <a href="https://developers.google.com/+/mobile/ios/api/protocol_g_p_p_native_share_builder-p#a9fabcb8ede280d903e1270f58e9928af" rel="noreferrer noopener nofollow">GPPNativeShareBuilder Protocol Reference</a> .根据此文档,您不能将 <code>attachImage</code> 与 <code>setTitle</code> 函数一起使用。 <code>setPrefillText</code> 函数可以解决您的问题。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何使用 google-plus-ios-sdk-1.7.1 sdk 登录 google-plus?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/26235833/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/26235833/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何使用 google-plus-ios-sdk-1.7.1 sdk 登录 google-plus?