MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
274 stars 246 forks source link

Cant login on iOS 18, XCode 16 Beta 3 #534

Open MSL-BIT opened 2 months ago

MSL-BIT commented 2 months ago

I wanted to ensure that my app runs smoothly on iOS 18, so I downloaded Xcode 16.0 beta 3 (16A5202i) and attempted to log in using AppAuth.

During testing on the simulator, I encountered an issue where the Safari ViewController appeared to freeze. The app didn’t crash, but it stopped producing console logs.

I'm using the flutter_appauth: ^7.0.0 version, and I also tested with version 6.0.7, but I experienced the same issue with both.

image

sillydomnom commented 2 months ago

I have exactly the same issue!

scsinke commented 2 months ago

I have the same issue. The thing is that when I run the package in a clean app it works with xcode 16 RC and iOS 18 simulator. @MSL-BIT can you confirm if for you it also works in a clean flutter app?

RutgerVleuten commented 2 months ago

@MSL-BIT Did you also check if this happens using a real device?

For me this only happens on iOS 18 simulators (also building with Xcode 15). When targetting a physical device I do not see the issue.

RutgerVleuten commented 2 months ago

The issue seems to happen when arm64 is excluded for simulator.

image
serraojoao commented 2 months ago

Any solution for this? I am able to test on a real device (Iphone SE) but unable to run any testing on simulators.

[Edit] Using Simulator with iOS 17.5 allows me to test.

MaikuB commented 2 months ago

I've tried the example app on an iPhone 16 simulator with iOS 18 and works fine

https://github.com/user-attachments/assets/c2324360-38e8-4244-b7a8-10d73aad1916

The example app doesn't have any excluded architectures either so whilst I've not tried it out myself, I'm inclined to believe what @RutgerVleuten shared is the reason. Has everyone here already checked this? This would be a setting for your individual apps

lohanmarques commented 2 months ago

I was having the same issue for days and erasing excluded archs resolved for me

sillydomnom commented 1 month ago

For us, removing arm from the excluded archs is not really a possibility as the App is afterwards unable to be built. We then get an error like: Building for 'iOS-simulator', but linking in object file (...) built for 'iOS' where Stack Overflow mentions to add arm64 to the excluded archs: https://stackoverflow.com/questions/63607158/xcode-building-for-ios-simulator-but-linking-in-an-object-file-built-for-ios-f

jonas2808 commented 1 month ago

@sillydomnom and me aligned to also try to run xCode 16.1 Beta 2 and the same issue is happening again.

MSL-BIT commented 1 month ago

So I did nothing but with the latest Flutter version it worked automatically. I do not know if this is connected to the Flutter upgrade but now the website is loaded successfully.

RutgerVleuten commented 1 month ago

@sillydomnom we have the same issue because there dependencies on MLKit that has no ARM64 simulator slice.

I managed to isolate the issue and it's on Apple's side. Seems running an app as Intel using Rosetta fails on an iOS 18.x simulator when starting an ASWebAuthenticationSession.

I reported it to Apple DTS with an example (see below) and waiting for response.

  func authenticateWithGoogle() {
        // Google OAuth 2.0 Authorization URL (example)
        let clientID = "your-google-client-id.apps.googleusercontent.com"
        let redirectURI = "com.yourapp:/oauth2redirect"
        let scope = "profile%20email"
        let responseType = "code"
        let authURLString = """
        https://accounts.google.com/o/oauth2/v2/auth?client_id=\(clientID)&redirect_uri=\(redirectURI)&response_type=\(responseType)&scope=\(scope)
        """

        guard let authURL = URL(string: authURLString) else {
            print("Invalid authentication URL")
            return
        }

        let authSession = ASWebAuthenticationSession(
            url: authURL,
            callbackURLScheme: "com.yourapp"
        ) { callbackURL, error in
            if let error = error {
                print("Authentication failed: \(error.localizedDescription)")
            } else if let callbackURL = callbackURL {
                self.handleCallbackURL(callbackURL)
            }
        }

        authSession.presentationContextProvider = self
        authSession.start()
    }
RutgerVleuten commented 1 month ago

@MaikuB Issue is there when you exclude Arm64 from your build. When you have nothing filled in it is included, like in your example app, this app will run native on an Apple silicon machines.

If you exclude arm64 (by filling this in the excluded architectures) it runs your app's process as "Intel" using rosetta 2.

image

And in this case you have the issue of the login WebView getting stuck on an iOS 18 simulator.

See also my previous post

Shakle commented 1 month ago

I don't use ios simulator for 2 weeks already because of it. So we have to wait for Xcode 16.1 or AppAuth lib update?

lauroboeni commented 1 month ago

Same here...

Shakle commented 3 weeks ago

Xcode 16.1 with iOS 18.1 simulator, still does not work.

Please tell us what to wait for.. we can't use ios simulators for more than a month already. Deleting excluded architectures is not an option, because then something else stops working

MaikuB commented 3 weeks ago

@Shakle did you read/see https://github.com/MaikuB/flutter_appauth/issues/534#issuecomment-2378886680?

Shakle commented 3 weeks ago

@MaikuB yes, but feels like it can be fixed even in a year or more, because Apple does not respond and care. So i thought that maybe some workaround is present, because i can't believe that everyone has just stopped using ios simulators.

RutgerVleuten commented 3 weeks ago

Had a call with Apple yesterday night to clarify the issue. It has now been escalated to the development team that's responsible for Simulators. They will send me an update if the issue is already on their backlog or if it's new.

Keep you posted.

note: since it's not a issue on a actual device and only i.c.w. Rosetta it will probably be not prioritised very high.

MaikuB commented 3 weeks ago

@RutgerVleuten thanks. Based on what I could see online, this technically shouldn't be new to them and have seen some comments that it was raised during beta

https://forums.developer.apple.com/forums/thread/764367 https://forums.developer.apple.com/forums/thread/764468

RutgerVleuten commented 3 weeks ago

@MaikuB thanks for the links, have added them to the submitted case.

sandrodz commented 6 days ago

I confirm.

Removing arm from excluded architectures list next to simulator fixes the issue.

image
ScorpioNicks commented 5 days ago

The app gets stuck after login on an iOS 18 device. The shell build from updated Mac, using the latest Xcode, works without involving Appium. However, the simulator displays the following console error: IntegrationApp(769,0x1f0094c00) malloc: xzm: failed to initialize deferred reclamation buffer (46).