I'm trying to deprecate iOS 13 from my app. One of the compilation warnings I got as a result was:
'SecRequestSharedWebCredential' is deprecated: first deprecated in iOS 14.0 - Use ASAuthorizationController to make an ASAuthorizationPasswordRequest (AuthenticationServices framework)
So I tried updating my code as follows
let provider = ASAuthorizationPasswordProvider()
let request = provider.createRequest()
let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.presentationContextProvider = self
authorizationController.performRequests()
But it always calls the delegate callback
func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error)
with error
Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1001 "No credentials available for login." UserInfo={NSLocalizedFailureReason=No credentials available for login.}
Even though the device (or simulator) has a stored password for my website. I have my website as an "associated domain" for my app of type webcredentials
.
What am I doing wrong here?