[ad_1]
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") {
googleDriveManager.authenticate()
}
}
}
.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
[ad_2]