[URGENT] 3rd Party Password Manager Autofill in Safari Freezes on iOS 13.4 due to inconsistent View lifecycle

Hi,


[EMERGENCY FIX NEEDED. ALL iOS 13.4 USERS ARE FACING FREEZE DUE TO THIS AND HAVE RATED THE APP NEGATIVELY]


The 3rd Party Password Autofill feature provided by Authentication Services has a weird issue in iOS 13.4. we verified on iOS 13.3 and it works without any issue.


I have reported a bug about the same with detailed video recordings that covers debugging the issue, which I will share with eskimo via E-mail.


Bug Scenarios(Tapping on any of the suggestions on the quick suggestion, quick-type bar or on the suggestions that appear on tapping the "Key" icon):

- I took time to debug this issue and found the following.

- When the user taps on any of the suggested logins, the ViewController that extends the CredentialProviderViewController is loaded and the viewDidLoad is called as expected.

- Once viewDidLoad is executed, viewWillAppear should get invoked but instead, viewDidLoad is invoked the second time. Not sure if the extension is being loaded twice or it is loaded once but the viewDidLoad is being invoked twice by the System.

- After viewDidLoad is executed the second time, the flow is suspended. Nothing happens.

- But, on tapping anywhere on the screen, viewWillAppear gets invoked immediately which is unexpected.

- After viewWillAppear is executed, the Autofill Extension is launched and executes perfectly.


Working scenarios(On tapping the application name on the Action sheet that pops-up on tapping the "Key" icon):

- In this scenario, when the user chooses to open the Autofill Extension implemented by the App, the flow works perfectly without issues.

- On tapping the "Application name" at the bottom of the Action Sheet that appears on tapping the "KEY" icon on the keyboard or the quick suggestion view, The Autofill extension of the App is launched perfectly without issues.

- viewDidLoad is invoked.

- Once viewDidLoad is executed, the flow continues to invoke viewWillAppear as expected and hence, the feature works perfectly fine in this scenario.


Possible Issues:

- viewDidLoad getting invoked twice and viewWillAppear never getting invoked unless the user taps anywhere on the screen.



Thanks,

Aravind Vaidhyanathan

Replies

I have gathered more details by debugging further. PLEASE DO NOT CLOSE THIS BUG UNTIL IT IS ACTUALLY FIXED BY APPLE:


- viewDidLoad gets called twice as our App forces user interaction to authenticate. Hence, the provideCredentialWithoutUserInteraction method is made to invoke cancelRequest with ASExtensionError.userInteractionRequired, which discards the currently loaded view and the System launches the CredentialProviderViewController freshly and invokes prepareInterfaceToProvideCredential.



- The issue has occurred because we were strictly relying on the viewWillAppear method to get called and were presenting the user interaction screens in the viewWillAppear flow.



- For some reason, on iOS 13.4, CredentialProviderViewController's viewWillAppear is not getting invoked after returning from prepareInterfaceToProvideCredential.



- As the name suggests, prepareInterfaceToProvideCredential is only meant to PREPARE the interface and NOT PRESENT the interface.



- What we have been doing, that is, presenting the user interaction view controllers in the viewWillAppear flow is actually RIGHT as per the point mentioned above.



- But as a WORKAROUND ONLY, NOT AS A PERMANENT FIX, we were able to get rid of this bug by presenting the user interaction view controller from within the prepareInterfaceToProvideCredential flow. THIS IS NOT ADVISABLE as the name clearly SUGGESTS THAT THE INTERFACE SHOULD ONLY BE PREPARED AND NOT PRESENTED.



- The conclusion is, Apple has to FIX THIS BUG OF VIEWWILLAPPEAR not getting invoked, which was not the case on iOS versions below 13.4.