I am making an attempt to implement bank card autofill in my iOS app utilizing the advisable textContentType
properties, however the autofill performance is not working in any respect.
I’ve arrange my textual content fields as follows:
cardNumberField.textContentType = .creditCardNumber
nameOnCardField.textContentType = .title
expirationDateField.textContentType = .creditCardExpiration
securityCodeField.textContentType = .creditCardSecurityCode
Nevertheless, once I faucet on these fields, iOS would not present any autofill solutions for saved bank cards.
What I’ve Tried
- Made positive I am utilizing iOS 14+ for the expiration and safety code fields
- Verified that I’ve bank cards saved in Safari’s Autofill settings
- Double-checked that each one fields are editable and enabled
- Confirmed the fields are correctly added to the view hierarchy
- Examined on a bodily system (iPhone 12, iOS 15.5)
Related Code
override func viewDidLoad() {
tremendous.viewDidLoad()
// Arrange textual content area content material sorts for bank card autofill
cardNumberField.textContentType = .creditCardNumber
nameOnCardField.textContentType = .title
if #obtainable(iOS 14.0, *) {
expirationDateField.textContentType = .creditCardExpiration
securityCodeField.textContentType = .creditCardSecurityCode
}
// Set keyboard sorts appropriately
cardNumberField.keyboardType = .numberPad
expirationDateField.keyboardType = .numberPad
securityCodeField.keyboardType = .numberPad
securityCodeField.isSecureTextEntry = true
}
Surroundings
- iOS 15.5
- Xcode 14.2
- Swift 5.7
- Testing on bodily system (not simulator)
Query
What may very well be stopping the bank card autofill performance from working regardless of setting the right textContentType
values? Is there any extra configuration wanted past setting these properties?