Post

Replies

Boosts

Views

Activity

Reply to WKWebView password autofill
Password AutoFill is the most frustrating concept/feature I have been working on in my many years as an app developer. It's a black box full of "magic" (or "heuristics" as Apple calls it) and the documentation is "theoretical". ASWebAuthenticationSession didn't help, so my workaround (hack) is to intercept credentials in webView(_:decidePolicyFor:decisionHandler:) on WKNavigationType.formSubmitted navigation type. I put the username and password in native UITextFields that is "hidden". Sidenote: This is against all security best practices. The textContentType needs to be set accordingly and the order the UITextFields are added to the parent view is super important, constraints does not seem to matter. Currently this works great on local debug builds, but for some reason doesn't on in-house/enterprise builds. The device console does not show anything helpful other that the com.apple.developer.associated-domains -> webcredentials for the domain was approved. Testing against a local webserver also does not work, which makes the trail'n'error approach needed to make this feature work even harder. You are suppose to add ?mode=developer to your webcredentials:example.com in your Associated Domains Entitlement setup. You also need to build using a dev profile + enable Associated Domains Development under iOS Settings -> Developer -> Universal Links. All to no avail.
Aug ’23