使用手動拖入Google 登錄SDK 方式接入
開發(fā)者平臺:https://console.firebase.google.com/
資源下載地址:https://developers.google.cn/identity/sign-in/ios/sdk/
1. 開發(fā)者平臺 - 登錄/注冊賬號 - 添加項(xiàng)目 - 輸入項(xiàng)目名稱 - 點(diǎn)擊繼續(xù)…

2. 點(diǎn)擊iOS - 進(jìn)入注冊應(yīng)用頁面

3. 點(diǎn)擊注冊應(yīng)用

4. 下載plist文件,并拖入項(xiàng)目中
注:plist文件中已包含Google 登錄ID與URL Types

5. 跳過第三、四、五步驟(添加 Firebase SDK),點(diǎn)擊下一步
6. 跳過驗(yàn)證安裝

7. 下載資源:https://developers.google.cn/identity/sign-in/ios/sdk/
8.?將SDK添加到您的Xcode項(xiàng)目

9. 添加依賴庫

10.?將ObjC鏈接器標(biāo)志添加?到應(yīng)用程序目標(biāo)的構(gòu)建設(shè)置中

11. 配置URL Types
打開項(xiàng)目中的?GoogleService-Info.plist,復(fù)制REVERSED_CLIENT_ID Value,填入U(xiǎn)RL Types

代碼實(shí)現(xiàn)步驟參考:https://developers.google.cn/identity/sign-in/ios/sign-in
12. 代碼調(diào)試AppDelegate.m 文件配置? ? ??
? ? ? ? 1)導(dǎo)入頭文件:import GoogleSignIn
? ? ? ? 2)設(shè)置clientID:GIDSignIn.sharedInstance()?.clientID = "打開項(xiàng)目中的?GoogleService-Info.plist,復(fù)制CLIENT_ID Value"
????????3)遵循協(xié)議:GIDSignInDelegate
????????4)設(shè)置代理:GIDSignIn.sharedInstance()?.delegate = self
? ? ? ? 5)實(shí)現(xiàn)代理方法:sign(_signIn:, didSignInFor user:,withError error:)
? ? ? ? 6)實(shí)現(xiàn)application:openURL:options:?
? ?????????????return (GIDSignIn.sharedInstance()?.handle(url))!
13. 控制器實(shí)現(xiàn)(參考:https://developers.google.cn/identity/sign-in/ios/sign-in)
? ? ? ? 1)導(dǎo)入頭文件:import GoogleSignIn
? ? ? ? 2)viewDidLoad中設(shè)置:GIDSignIn.sharedInstance()?.presentingViewController = self
? ? ? ? 3)viewDidLoad中?自動登錄:[[ GIDSignIn sharedInstance ] restorePreviousSignIn ];
? ?????????????歷史無登錄/已退出登錄,回調(diào)狀態(tài)為:GIDSignInErrorCode.hasNoAuthInKeychain
? ? ? ? 4)拉起登錄
? ? ? ? ? ? ? ? a. 自定義按鈕樣式
? ? ? ? ? ? ? ? ? ? 按鈕事件中調(diào)用:GIDSignIn.sharedInstance()?.signIn()
? ? ? ? ? ? ? ? b. 使用Google SDK 中自帶的GIDSignInButton?
? ? ? ? ? ? ? ? ????xib:拖入U(xiǎn)IView,將UIView的Class 改成GIDSignInButton
14. 進(jìn)入調(diào)試
?簡單記錄接入過程