2015-09-24 49 views
4

我遇到Google登錄問題,無法重定向到我的應用程序。Google登錄未返回到我的應用程序

我按照步驟(https://developers.google.com/identity/sign-in/ios/start-integrating)安裝了cocoapods,下載了GoogleService-Info.plist(將它添加到我的所有目標中),添加了URL Types(我的bundle標識符,然後是我的反向客戶端ID到我的目標和隨後線的步驟線

這裏是plist中CFBundleURLTypes的源代碼:

<dict> 
     <key>CFBundleTypeRole</key> 
     <string>Editor</string> 
     <key>CFBundleURLSchemes</key> 
     <array> 
      <string>MY_REVERSE_CLIENT_ID</string> 
     </array> 
     <key>CFBundleURLName</key> 
     <string>MY_BUNDLE_ID</string> 
    </dict> 
    <dict> 
     <key>CFBundleTypeRole</key> 
     <string>Editor</string> 
     <key>CFBundleURLSchemes</key> 
     <array> 
      <string>MY_BUNDLE_ID</string> 
     </array> 
     <key>CFBundleURLName</key> 
     <string>MY_BUNDLE_ID</string> 
    </dict> 

在App代表,我配置了[GGLContext sharedInstance]和在應用OpenURL方法我added-

return [[GIDSignIn sharedInstance] handleURL:url sourceApplication:sourceApplication annotation:annotation];

如果Google Plus應用程序未安裝,Safari會在應用程序中打開並且一旦登錄,委託回調方法就會按預期工作。

我認爲這是iOS9的問題。這在iOS8以前工作。

我還在我的plist中添加了com-google-gidconsent和com-google-gidconsent-google到LSApplicationQueriesSchemes,因爲我看到另一篇文章說這可能是問題。

我已經檢查過在谷歌開發者門戶中,我的捆綁包ID與我的項目的捆綁ID以及客戶端ID和反向客戶端ID是否正確。

我有三個目標(生產,分期和測試)。我目前只是試圖讓生產目標正常工作。

我有另一個視圖控制器,用戶點擊一個谷歌按鈕,然後該按鈕的動作是[[GIDSignIn sharedInstance] signIn];這使用戶訪問Google Plus應用程序並提示用戶選擇一個帳戶。一旦選擇了一個帳戶,Google plus應用程序會詢問用戶我的應用是否可以訪問他們的信息。一旦用戶點擊確定,就不會回調我的應用程序。用戶只是停留在Google Plus應用程序中。我在應用程序openURL方法中有一個斷點,它永遠不會被擊中。

有趣的是,如果我和我的反向客戶端ID的URL方案配置我的plist與COM-谷歌-gidconsent,谷歌和com.google.gidconsent,應用OpenURL方法被擊中,但

[ GIDSignIn sharedInstance] handleURL:url sourceApplication:sourceApplication annotation:annotation];

評估爲否。

任何幫助將不勝感激。

+0

請提供真實的'CFBundleURLTypes' plist值。 – ajmccall

回答

3

檢查您的應用程序:openURL:sourceApplication:annotation:method或application:openURL:options :(取決於您在AppDelegate中擁有哪一個)。應該是這樣的谷歌網址計劃實施

return [[GIDSignIn sharedInstance] handleURL:url sourceApplication:sourceApplication annotation:annotation]; 
0

我讀到,你把你的plist的計劃。但無論如何,我會把xml(plist文件)與必要的網址一起配置google plus。第一行應該是你在你的谷歌開發者控制檯中用你的客戶端ID「iOS URL Scheme」找到的內容。

<key>LSApplicationQueriesSchemes</key> 
<array> 
<string>com.googleusercontent.apps.123456789012-abcdefghijklmnopqrstuvwxyz</string> 
<string>com-google-gidconsent-google</string> 
<string>com-google-gidconsent-youtube</string> 
<string>com-google-gidconsent</string> 
<string>com.google.gppconsent.2.4.1</string> 
<string>com.google.gppconsent.2.4.0</string> 
<string>googlechrome</string> 
<string>googlechrome-x-callback</string> 
<string> https://www.googleapis.com/auth/plus.login</string> 
</array> 
相關問題