简体   繁体   中英

Why isn't sign in with apple button working?

When I drag out the SignInWithAppleButton control using swiftui, this is the code that is shown. However, I get the error message "Argument passed to call that takes no arguments". The compiler only allows the project to build when SignInWithAppleButton() is used.

I've found lots of code online that uses the below format. Why isn't it working now? What is the correct alternative if onRequest and onCompletion can't be used?

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

works for me on macos 12.beta using xcode 13.beta, target ios 14.5 and macCatalyst 11.3. What system are you using?

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)
    }
}

When I drag out the SignInWithAppleButton control using swiftui, this is the code that is shown. However, I get the error message "Argument passed to call that takes no arguments". The compiler only allows the project to build when SignInWithAppleButton() is used.

I've found lots of code online that uses the below format. Why isn't it working now? What is the correct alternative if onRequest and onCompletion can't be used?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM