簡體   English   中英

為什么無法使用蘋果按鈕登錄?

[英]Why isn't sign in with apple button working?

當我使用 swiftui 拖出 SignInWithAppleButton 控件時,顯示的代碼如下。 但是,我收到錯誤消息“傳遞給不帶參數的調用的參數”。 編譯器僅允許在使用 SignInWithAppleButton() 時構建項目。

我在網上發現了很多使用以下格式的代碼。 為什么它現在不起作用? 如果不能使用 onRequest 和 onCompletion,正確的選擇是什么?

            SignInWithAppleButton(
            onRequest: { request in
                
            },
            onCompletion: { result in
                
            }
        )

使用 xcode 13.beta,目標 ios 14.5 和 macCatalyst 11.3 在 macos 12.beta 上為我工作。 你用的是什么系統?

import SwiftUI
import AuthenticationServices

@main
struct TestApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
struct ContentView: View {
    var body: some View {
        SignInWithAppleButton(onRequest: { request in
             print("onRequest")
         },
         onCompletion: { result in
            print("onCompletion")
         }
        ).frame(width: 222, height: 66)
    }
}

當我使用 swiftui 拖出 SignInWithAppleButton 控件時,這是顯示的代碼。 但是,我收到錯誤消息“傳遞給不帶參數的調用的參數”。 編譯器僅在使用 SignInWithAppleButton() 時才允許構建項目。

我在網上找到了很多使用以下格式的代碼。 為什么現在不工作了? 如果 onRequest 和 onCompletion 不能使用,正確的選擇是什么?

            SignInWithAppleButton(
            onRequest: { request in
                
            },
            onCompletion: { result in
                
            }
        )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM