I am creating an NSURLCredential with NSURLCredentialPersistencePermanent and using it to authenticate an AFHTTPRequestOperation as follows:
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
NSURLCredential *credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistencePermanent];
[operation setCredential:credential];
Once authenticated, the credential no longer needs to be set on future operations.
However, once I re-launch the app, while the credential is still present in [NSURLCredentialStorage sharedCredentialStorage]
, the next AFHTTPRequestOperation is no longer authenticated and returns an access denied response.
Why doesn't AFNetworking recognize the credential which exists in the shared credential storage?