But, can we use the acquire in an onboarding screen outside the card payment process? I mean, just for asking the permission. I have tried something like this:
class OnboardingPaymentScreenVC: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
configure()
askPermissionButton.setTitle("Ask for contactless payment permission", for: .normal)
askPermissionDescription.text = "This will allow you to pay with our app using your contactless card."
askPermissionButton.addTarget(self, action: #selector(askPermissionAction), for: .touchUpInside)
}
@objc func askPermissionAction() {
Task() {
do {
let _ = try await NFCPresentmentIntentAssertion.acquire()
// Manage permission granted
} catch let error {
if let hceError = error as? NFCPresentmentIntentAssertion.Error {
switch hceError {
case .systemEligibilityFailed: break
// Manage permission denied
case .systemNotAvailable:
print("Error PRESENT: \(hceError)")
@unknown default:
print("Error PRESENT: \(hceError)")
}
}
}
}
}
}
It works as I expected but I do not know if it is a bad practice and it could be considered as cause of rejecting the app in the review process to de Apple Store.
Thank yo so much
Topic:
App & System Services
SubTopic:
General
Tags: