[英]Issue with Sign In With Apple - unable to retrieve name and email
I used sample code from Apple's Juice example application to implement SIWA.我使用来自 Apple 的 Juice 示例应用程序的示例代码来实现 SIWA。 But it returns nil for both name and email.
但它对名称和 email 返回 nil。 To delete any previously saved credentials, I used this code:
要删除任何以前保存的凭据,我使用了以下代码:
static func deleteUserIdentifierFromKeychain() {
do {
try KeychainItem(service: "app.bundle.ID", account: "userIdentifier").deleteItem()
} catch {
print("Unable to delete userIdentifier from keychain")
}
}
Then ran this code to request scope with full name and email scopes:然后运行此代码以请求具有全名和 email 范围的 scope:
let request = ASAuthorizationAppleIDProvider().createRequest()
request.requestedScopes = [.fullName, .email]
let controller = ASAuthorizationController(authorizationRequests: [request])
controller.delegate = self
controller.presentationContextProvider = self
controller.performRequests()
When I read the return values from ASAuthorizationAppleIDCredential, I get nil and nil.当我从 ASAuthorizationAppleIDCredential 读取返回值时,我得到了 nil 和 nil。 I do get a user identifier but no name or email.
我确实得到了一个用户标识符,但没有名称或 email。
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
switch authorization.credential {
case let appleIDCredential as ASAuthorizationAppleIDCredential:
let userIdentifier = appleIDCredential.user
let fullName = appleIDCredential.fullName
let appleEmail = appleIDCredential.email
What am I doing wrong?我究竟做错了什么?
Go to Apple ID settings -> delete the app from list of apps using Apple ID will reset the SIWA in iOS. Go 到 Apple ID 设置 -> 从使用 Apple ID 的应用程序列表中删除应用程序将重置 iOS 中的 SIWA。 Thus allowing you to test in a sandbox.
从而允许您在沙箱中进行测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.