我正在尝试使用 SwiftUI 实现使用 Apple 登录,但在我输入正确的密码后它挂起。
我正在使用真实用户和模拟器以及 XCode 12.0 Beta。不幸的是,我现在没有可供测试的设备。我也尝试过沙盒用户,但没有成功。
我已将使用 Apple 功能的登录添加到配置文件中
永远不会达到成功的打印语句。
我错过了什么?
使用来自 https://developer.apple.com/documentation/swiftui/signinwithapplebutton 的示例代码
import SwiftUI
import AuthenticationServices
struct SignInView: View {
var body: some View {
VStack {
SignInWithAppleButton(
.signIn,
onRequest: { request in
request.requestedScopes = [.fullName]
},
onCompletion: { result in
switch result {
case .success (let authResults):
print("rhe01 Authorization successful.")
case .failure (let error):
print("rhe01 Authorization failed: " + error.localizedDescription)
}
}
)
}
}
}
最佳答案
不幸的是,这是 Xcode 12.0b1 模拟器中的一个错误 - 参见 this thread在苹果的论坛上。
关于SwiftUI SignInWithAppleButton 挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62713693/