在范围内找不到 SignInWithAppleButton (SwiftUI 2)
Posted
技术标签:
【中文标题】在范围内找不到 SignInWithAppleButton (SwiftUI 2)【英文标题】:SignInWithAppleButton not found in scope (SwiftUI 2) 【发布时间】:2020-12-31 13:00:35 【问题描述】:我正在 SwiftUI 应用程序(ios 14、SwiftUI 2)中实现 Sign In With Apple。我正在导入 AuthenticationServices 框架。应用构建成功,可以在 iOS 设备或模拟器上运行。但我无法在 Preview / Canvas 中预览视图(设计视图会更容易)。
Cannot find 'SignInWithAppleButton' in scope
知道为什么吗? 谢谢 阿克塞尔
PS:Xcode 12 beta 6、macOS Big Sur beta 5
【问题讨论】:
这对您来说仍然是个问题吗?我在 Xcode 12 stable(版本 12.0.1 (12A7300))上,这似乎已经解决了。 最新版本的 Xcode 解决了这个问题。 【参考方案1】:自 beta 6 以来,SignInWithAppleButton
的命名空间已从 SwiftUI
移动到 AuthenticationServices
。只需 import AuthenticationServices
。
【讨论】:
以上是关于在范围内找不到 SignInWithAppleButton (SwiftUI 2)的主要内容,如果未能解决你的问题,请参考以下文章
Xcode ViewController 显示在范围内找不到“支付”
在范围内找不到类型“ListenerRegistration”