背景
自蘋果推出了 Sign in with Apple
功能后,很快審核指南就加入 4.8 :使用第三方登錄的App推励,都必須接入AppleID
登錄 迎瞧。已經(jīng)上架的 App 需在 2020 年 4 月 前完成接入工作甜癞, 新老App一樣對(duì)待纤垂。
基本流程
App
1.首先需要配置Sign In with Apple
2.生成私鑰矾策。勾選Sign In with Apple
,->Configure峭沦,選擇Primary App ID
贾虽,生成新的.p8私鑰。
3.項(xiàng)目中配置Capability
4.集成AuthenticationServices
.
- 官方提供了
ASAuthorizationAppleIDButton
(繼承自UIControl
)吼鱼,來創(chuàng)建按鈕蓬豁。
private let appleButton: ASAuthorizationAppleIDButton = {
let button = ASAuthorizationAppleIDButton(authorizationButtonType: .signIn, authorizationButtonStyle: .white)
return button
}()
按鈕樣式有
white
、whiteOutline
蛉抓、black
三種庆尘,Api部分比較簡(jiǎn)單,直接看代碼就好了巷送。值得一提的是,現(xiàn)在Apple明顯嚴(yán)肅了對(duì)AppleID登錄功能的UI規(guī)范審核矛辕,聽聞很多小伙伴的App也都因這個(gè)問題而審核被拒笑跛,我這里也提一下×钠罚基本小伙伴收到的都是下面的這種被拒原由:
Guideline 4.0 - Design
We noticed an issue in your app that contributes to a lower quality user experience than Apple users expect:
- Your app uses Sign in with Apple as a login option but does not use Sign in with Apple button design, branding and/or user interface elements appropriately as described in the Sign in With Apple Human Interface Guidelines.
這個(gè)問題飞蹂,只要大家認(rèn)真閱讀https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons并按照上面的要求修改,都不會(huì)再有問題翻屈。
-
ASAuthorizationAppleIDCredential
信息釋義:
User ID: 蘋果用戶唯一標(biāo)識(shí)符陈哑,該值在同一個(gè)開發(fā)者賬號(hào)下的所有 App 下是一樣的,開發(fā)者可以用該唯一標(biāo)識(shí)符與自己后臺(tái)系統(tǒng)的賬號(hào)體系綁定起來。
Verification data:Identity token
,code
驗(yàn)證數(shù)據(jù)惊窖,用于傳給開發(fā)者后臺(tái)服務(wù)器刽宪,然后開發(fā)者服務(wù)器再向蘋果的身份驗(yàn)證服務(wù)端驗(yàn)證本次授權(quán)登錄請(qǐng)求數(shù)據(jù)的有效性和真實(shí)性
Account information: 蘋果用戶信息,包括全名界酒、郵箱等
Real user indicator: 用于判斷當(dāng)前登錄的蘋果賬號(hào)是否是一個(gè)真實(shí)用戶
AuthenticationServices 框架概述
- 1.
Sign In with Apple
使用Apple
登錄 - 2.
Password-Based Login
基于密碼的登錄 - 3.
Web-Based Login
基于web
的登錄 - 4.
Enterprise Single Sign-On
企業(yè)單點(diǎn)登錄SSO - 5.
AutoFill Credential Provider Support
自動(dòng)填充驗(yàn)證提供者支持 - 6.
Web Browser Authentication Session Support web
瀏覽器認(rèn)證會(huì)話支持