Monday, April 15, 2024
HomeIOS Developmentios - Is there any strategy to right this authentication drawback?

ios – Is there any strategy to right this authentication drawback?

I’m attempting to implement a connection of my utility in SwiftUI with Google Drive, I’ve created the undertaking in Google and I have already got the consumer ID, however once I authenticate, I get this message.”Thread 1: “uiDelegate should both be to |UIViewController| or implement the |signIn:presentViewController:| and |signIn:dismissViewController:| strategies from |GIDSignInUIDelegate|.” I’m utilizing Xcode 15.1 and Swift 5.9.2.

// I attempt to do the authentication from the contentview
import SwiftUI
import GoogleSignIn
struct ContentView: View {
@StateObject non-public var googleDriveManager = GoogleDriveManager()

var physique: some View {
    VStack {
        if googleDriveManager.isSignedIn {
            Textual content("Usuario autenticado")
        } else {
            Button("Iniciar sesión con Google") {
    .onAppear {
        // Establecer el uiDelegate al rootViewController
        GIDSignIn.sharedInstance().uiDelegate = UIApplication.shared.home windows.first?.rootViewController as? UIViewController as? any GIDSignInUIDelegate


// The app stops working once I press the button and I get the error talked about



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments