2014-09-03 207 views
4

我可以在我的iOS應用程序內登錄Google+。我爲此使用GoogleOAOA類。https://www.googleapis.com/auth/plus.login範圍權限無法獲得授權

但問題是,我不能設置範圍https://www.googleapis.com/auth/plus.login許可。

如果我嘗試設置此範圍,那麼我無法獲得授權成功。

否則如果我不要求這個範圍的權限,我會獲得成功。

但爲了獲取收集信息,我需要此範圍的權限。

如果有人意識到這個問題,請幫助我。

回答

0

希望這有助於你:

  • 獲取對GPPSignIn參考共享實例:

    GPPSignIn *signIn = [GPPSignIn sharedInstance]; 
    
  • 設置的OAuth 2.0範圍要請求:

    [signIn setScopes:[NSArray arrayWithObject: "https://www.googleapis.com/auth/plus.login"]]; 
    

    致電[signIn setDelegate:self];

  • 設置委託方法finishedWithAuth:error :. 從應用程序調用共享實例上的handleURL:openUrl:...在您的應用程序委託中。

    Call [signIn authenticate]; 
    

參考,請參閱 「Google+登錄爲iOS」 在https://developers.google.com/+/mobile/ios/sign-in。以下是使用GPPSignIn的示例代碼:

+0

首先感謝您回覆:)....其實我意識到使用其sdk集成Google+,但Google + _sdk在應用程序內部不提供我登錄對話框,這就是爲什麼我嘗試Google +驗證類。 – Anuj 2015-09-03 11:28:40

+0

希望這可以幫助你:[谷歌+ iPhone API登錄和共享,而不必離開應用程序](http://stackoverflow.com/questions/15281386/google-iphone-api-sign-in-and-share-without-leaving-應用程序/ 24577040#24577040) – Sujania 2015-09-03 11:47:09