首页 > 解决方案 > 任何人都可以使用 SwiftUI SignInWithAppleButton 在 tvOS 上工作

问题描述

我正在尝试使用 SwiftUI 的 SignInWithAppleButton 与 tvOS 一起使用?我遇到了一个问题,请求和完成块没有被调用,并且我可以找到的任何日志中都没有错误。它只是为点击设置动画,仅此而已。这已经在带有 tvOS 14 的实际 Apple TV 上进行了测试。

我的代码是一个简单的页面:

import SwiftUI
import AuthenticationServices

struct SignInView: View {
    var body: some View {
        VStack(spacing: 40) {
            Text("Welcome to My App")
                .font(.system(size: 50.0, weight: .bold))

            SignInWithAppleButton(.signIn) { request in
                request.requestedScopes = [.fullName, .email]
            } onCompletion: { result in
                print(result)
            }
            .signInWithAppleButtonStyle(.whiteOutline)
            .frame(width: 300, height: 50)
        }
        
    }
}

我根本看不到结果或请求块被调用。

标签: swiftuitvossign-in-with-apple

解决方案


推荐阅读