iOS 11 password autofill doesn't save password

2020-07-09 10:15发布

问题:

I'm using Password Autofill feature in the iOS app.

I've set the needed textContentType properties to username and password respectively. Also, I've enabled iCloud Keychain in the iOS settings.

The bar appears, I'm able to fill in the login form with the credentials from other apps. However, I'm unable to save the credentials I enter.

Is it possible to Save credentials to the keychain without associating the app with the website, like shown in the WWDC session?

回答1:

No, It's not possible to add credentials to ICloud Keychain without associating a domain to it. Apple needs it to identify and suggest the credentials based on that registered domain.

looks like this feature existed since IOS 8, In IOS 11 they just updated it to make it easier by adding textContentType in uitextinputtraits and automating the process a bit.

You can manage Icloud Keychain Credentials Using Security.SecSharedCredentials Apis

SecAddSharedWebCredential - you can provide your domain(yourwebsite.com), userName, and Password as params to be saved in ICloud Keychain. from the looks of it will show an alertView for confirmation to save/update.