I am attempting to implement bank card autofill in my iOS app utilizing the really useful 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
Nonetheless, after I faucet on these fields, iOS would not present any autofill options for saved bank cards.
What I’ve Tried
- Made certain 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 machine (iPhone 12, iOS 15.5)
Related Code
override func viewDidLoad() {
tremendous.viewDidLoad()
// Arrange textual content discipline 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
}
Setting
- iOS 15.5
- Xcode 14.2
- Swift 5.7
- Testing on bodily machine (not simulator)
Query
What could possibly be stopping the bank card autofill performance from working regardless of setting the right textContentType
values? Is there any further configuration wanted past setting these properties?