aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 880 forks source link

AWSMobileClient signIn webview freezes in XCode 16 and iOS 18. #5441

Open dcristolovean opened 3 days ago

dcristolovean commented 3 days ago

Describe the bug As the title states, the webview login screen completely freezes as soon as it loads.

MacOS Sequoia 15.0, no betas. The issue occurs only on XCode 16. Installing XCode 15.4 on the same machine (with a bit of trickery) works. The Login webview appears correctly and doesn't freeze.

To Reproduce

  1. Just a simple AWSMobileClient.default().showSignIn that worked before in the previous XCode and iOS17.x
  2. WebView starts, but freezes immediately. You can see the Cancel on top left, buttons top right and the bottom bar of the browser. Content is empty.

Observed Behavior Web login completely frozen and empty, no button works from the webview

Expected Behavior Normal standard login.

Code Snippet AWSMobileClient.default().showSignIn(navigationController: nav, hostedUIOptions: hostedUIOptions) { userState, error in ..... }

Screenshots Simulator Screenshot - iPhone 16 Pro Max - 2024-09-20 at 19 23 11

Environment(please complete the following information):

Device Information (please complete the following information):

phantumcode commented 3 days ago

@dcristolovean Thanks for submitting the issue. We'll work on reproducing the issue and provide updates. Does the issue exist when running on a real device with iOS 18? or when running with Xcode 18 but with iOS simulator running iOS 17.x?

dcristolovean commented 3 days ago

I only use the simulators at the moment. The issue appears when running all the 'new' stuff: Xcode 16, iOS18 simulators.

I am now running my code on the same machine, Xcode 15.4 downloaded and run separately from my XCode 16 and it works. In the 17.5 simulators, of course, I can't use an 18 simulator on XCode 15.4 :)

Ask me for any other details, this is quite urgent for us, I have to do some iOS 18 related fixes and if AWS fails, we're dead in the water. Thank you.

dcristolovean commented 3 days ago

and on an unrelated note, but still iOS 18 related. We're using AWS AppSync. That SDK is dead, maintenance mode. There was an iOS 18 compile error issue, they fixed it but they only pushed in main, not created a new version, since it's... in maintenance mode. So now that package depends on AWS 2.36.x

If you find and fix the issue I have with login, what will happen ? You'll bump the version to another 2.37.x which I won't get because of AppSync.

Maintenence mode or not, AppSync needs to update it's dependencies, otherwise the entire AWS SDK becomes useless in Xcode 16 and iOS18. You can't login anymore if you have AppSync in your app. Am I wrong here ?

ruisebas commented 3 days ago

Hi @dcristolovean. I was unable to reproduce this issue running a simple project in an iOS 18 simulator, the login webview loads successfully with no freezing. I've tried both with Xcode 15.4 and Xcode 16.

To help us investigate further, please provide the following:

dcristolovean commented 1 day ago

Hello.

  1. Here's my configuration. It's not an awsconfiguration.json file, it's a dynamic dictionary that is set into AWSInfo.configureDefaultAWSInfo. We have multiple targets and their info is configured server side and served via Firebase before we init AWS.

{ "PinpointTargeting": { "Default": { "Region": "eu-west-1" } }, "S3TransferUtility": { "Default": { "Region": "eu-west-1" } }, "PinpointAnalytics": { "Default": { "AppId": "xxxx", "Region": "eu-west-1" } }, "CognitoUserPool": { "Default": { "PoolId": "eu-west-xxxx", "Region": "eu-west-1", "MigrationEnabled": true, "AppClientId": "xxxx", "AppClientSecret": "xxxx" } }, "AppSync": { "business_chat_qa": { "ClientDatabasePrefix": "ChatAppSyncApi-qa_AWS_IAM", "AuthMode": "AWS_IAM", "Region": "eu-west-1", "ApiUrl": "https://qa.api-chat.xxxx.com/graphql" } }, "CredentialsProvider": { "CognitoIdentity": { "Default": { "Region": "eu-west-1", "PoolId": "eu-west-1:xxxx" } } }, "IdentityManager": { "Default": { "Region": "eu-west-1" } }, "Auth": { "Default": { "authenticationFlowType": "USER_PASSWORD_AUTH", "OAuth": { "Scopes": [ "openid", "email", "aws.cognito.signin.user.admin", "phone", "profile" ], "SignOutRedirectURI": "xxx://signout", "AppClientId": "xxxx", "WebDomain": "xxxx.auth.eu-west-1.amazoncognito.com", "AppClientSecret": "xxxx", "SignInRedirectURI": "qa-xxx://signin" } } } }

  1. Logging doesn't help much in this particular case, there's nothing logged when I call AWSMobileClient.default().showSignIn

Before I ask the user to sign in, there are indeed operations done with AWS and those are OK, logs show what's happening and all's good. (we using API Gateway) - non-auth user

Then, asking the user to login -> I get the system dialog then webview stuck, no logs.

We use standard providers, like FB, Google, Apple and also other 3rd parties SSOs. They all get stuck in xcode 16, but they all work in 15.4

  1. I need also a working solution for AWSAppSync, so we don't get stuck with an old AWS version and can't update anymore in the future. I understand it's under maintenance, but you can't have a package that blocks your entire AWS framework from getting updates. What can I do in that case ? One thing would be to get rid of the AWSAppSync Pod and just add the AWSAppSync files by hand in my project, hoping it will work ?

Updating to Amplify is not a viable solution now, it will take an extremely long time because of all our services we're using. Only API Gateway has > 300 API requests, with the auto-generated models that come with it that now need to be done by hand, since Amplify doesn't auto-generate them. And many many other little things, Cognito, AppSync, S3, SNS, Pinpoint etc It's planned for the future, but out of the question at the moment.

  1. Here's my pod file:

AWS

pod 'AWSCore'
pod 'AWSRuntime'
pod 'AWSAPIGateway'
pod 'AWSPinpoint'
pod 'AWSPluginsCore'
pod 'AWSSNS'
pod 'AWSS3'
pod 'AWSCognitoIdentityProvider'
pod 'AWSMobileClient'
pod 'AWSAuthUI'
pod 'AWSUserPoolsSignIn'
pod 'AWSAppSync', :git => 'git@github.com:awslabs/aws-mobile-appsync-sdk-ios.git', :tag => 'main'
  1. Not sure if it helps and it's not really visible in my screenshot, but when the webview is stuck, it's also not displayed correctly. It seems to have a ~ 20pt top safe area, but also a ~ extra 20pt bottom that makes the bottom bar being cut a bit, like it's out of the screen.
phantumcode commented 20 hours ago

@dcristolovean Are you able to configure verbose logging and attach the log output for us to troubleshoot even if you think that the log is not helpful?

dcristolovean commented 19 hours ago

I created a test project that has the exact same issue. The only logging I have is this:

Configuring SignInProvider : CognitoUserPool. Registering SignInProvider AWSCognitoUserPoolsSignInProvider from awsconfiguration.json.

Then nothing when I press a button and start the SignIn process.

I created the project with our credentials so it actually connects to something. Is there a way to give that to you ?

phantumcode commented 17 hours ago

@dcristolovean You can upload the project as a zip file with any sensitive or confidential information redacted.

dcristolovean commented 16 hours ago

AWSTest.zip

It's just a simple proj I created today, all's in ContentView.swift. It starts AWS with a 'dynamic' dictionary and then tries to login via Google. You need to add your ids/secret. Pods are already included, so it should work as it is. Running on XCode 15.4 opens the webview and tries to login with Google, page loads. Running on XCode 16 opens the frozen webview as shown in the previous screenshot.

Running both XCodes is a bit tricky, since officially XCode 15.4 doesn't work in macOS 15. I downloaded 15.4 from Apple and switching between XCodes with sudo xcode-select -s /Applications/Xcode.app/ and sudo xcode-select -s /Applications/Xcode154.app/

To actually start XCode 15.4, you need to Show Package Content on it, Contents -> MacOS -> and double click on XCode in there to actually start it.

Sorry if you knew that already.

ruisebas commented 15 hours ago

Thanks for providing the project. I'll take a look and post updates in here.

ruisebas commented 14 hours ago

@dcristolovean I was able to reproduce the issue with the project you provided, which is very similar to the one I used when attempting to reproduce.

So I compared both of them and noticed you have arm64 as Excluded Architectures in your AWSTest target and the following in your Podspec file's post_install script:

    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end

Is there a reason you need this exclusion? I removed it and the project still builds successfully, and then the sign in webview loads correctly. As to why this is only now causing issues, my guess is that Apple changed something internally when building for iOS 18.


Regarding AppSync SDK for iOS, its maintenance mode has already ended, so there will be no more updates nor support going forward. If you need to use it with the latest AWS SDK for iOS releases, another alternative besides copying the source files locally is to fork the repository, make the required changes and update your Podspec to use your fork instead. But please be aware that we cannot provide support for either option.

dcristolovean commented 3 hours ago

Oh yes, without that exclusion you'll get tons of errors in other Pods. Mostly Firebase and Google that also load BoringSSL or grpc and so on. Those don't even compile without those exclusions. You can just try to add these to my Podfile:

pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'

# google
pod 'GoogleSignIn'
pod 'Firebase'
pod 'FirebaseCore'
pod 'FirebaseAnalytics'
pod 'FirebaseDynamicLinks'
pod 'FirebaseDatabase'
pod 'FirebaseAuth'
pod 'FirebaseFirestore'
pod 'FirebasePerformance'
pod 'FirebaseCrashlytics'

Even when I made this simple test project, I couldn't compile it with all these Pods, unless I have all those modification in the Pod file. From Excluded Architectures to Deployment Target set to 13, Disable Bitcode and so on.

Remove the Excluded Archs from the pod file, add those and do a pod install. I couldn't get it to work without excluding arm64. And that's what tons of post of the web suggest as a fix. Now if this impacts some webview from AWS, we're in a pickle, aren't we ? :)

Any suggestions ?

LATER EDIT: But wait a minute, even AWS doesn't work if I comment out the excluded arm64. Project doesn't even compile, it cant' find any AWS imports and stops.
So... leave the Podfile as it is from my project, comment out this:

installer.pods_project.build_configurations.each do |config|
  config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end

Clear Derived Data, clear Build Folder and then try to compile. It won't work. Even AWS needs that :( It's VERY important to clear the data/build folder, otherwise it's gonna work from cache. As soon as you clean up the project, with the commented excluded arch and pod install -> Error -> No such module AWSMobileClient.