3

The Apple documentation for NSURLCredential says that it may not always return a password. But other than the obvious reason that no password was stored with credential, is there any reason that a default credential permanently stored in NSURLCredentialStorage would randomly return no password?

The odd thing is some percentage of the time it works fine. But occasionally reading the password property on a default credential returns nil. The credential object appears to be valid in other respects, but the password property just returns nil.

The password reading is occurring in a thread that isn't the main thread, so I was wondering if there is some threading limitation, though I couldn't find anything in the doc.

Is it possible that we need to retry getting the password after some period of time or something?

len.kawell
  • 31
  • 1

1 Answers1

0

If it's permanent and the keychain is locked, that will do it. Most applications won't run into this problem, as the default behavior would only make the keychain locked in unusual cases. NSURLCredentials should be stored with the default kSecAttrAccessible attribute (kSecAttrAccessibleWhenUnlocked). This article describes some of these behaviors.

quellish
  • 21,123
  • 4
  • 76
  • 83