I want this alert to appear when the user logs in to my application.
I made this tutorial for this. iOS 12 Password Tools: Improving User Security and Experience
Also I have look this topic. And using this code in my LoginViewController.swift in viewDidDisappear or viewWillDisappear. But This alert does not appear at all.
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if user.id != 0 {
usernameTextField.text = nil
passwordTextField.text = nil
}
}
My entitlements file like this (Suppose that twitter.com is the website of my application):
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:twitter.com</string>
<string>webcredentials:twitter.com</string>
</array>
<key>com.apple.developer.authentication-services.autofill-credential-provider</key>
<true/>
And off course my usernameTextField content type is username and passwordTextField content type is password.
So I want to ask why this alert didn't come off.
When creating a new account or changing the password, use the .newPassword text content type for the password TextField:
newPasswordTextField.textContentType = .newPassword
confirmPasswordTextField.textContentType = .newPassword
Enabling Password AutoFill on a Text Input View
You can also manage iCloud Keychain Credentials using the Security.SecSharedCredentials API. It will still require a domain association (entitlements):
SecAddSharedWebCredential("your_domain.com" as CFString,
usernameTextField.text as CFString,
newPasswordTextField?.text as CFString, {(error) in })
SecAddSharedWebCredential
Next, you should add the Apple App Site Association file to your website.
Create a file named apple-app-site-association (without an extension). Update the file to contain the JSON representation of a dictionary listing the app identifiers associated with your domain for the webcredentials service.
{
"webcredentials": {
"apps": [ "D3KQX62K1A.com.example.DemoApp",
"D3KQX62K1A.com.example.DemoAdminApp" ]
}
}
Use the following format for the app identifiers:
<Team Identifier>.<Bundle Identifier>
Place this file either in your site’s .well-known directory, or directly in its root directory. If you use the .well-known directory, the file’s URL should match the following format:
https://<fully qualified domain>/.well-known/apple-app-site-association
You must host the file using https:// with a valid certificate and without using any redirects.
Setting Up an App’s Associated Domains
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With