title: Cannot load generic password from iOS Keychain (errSecNotAvailable -25291)
body: <p>This happens on iOS 13.3 (iPhone 11)</p>
  
  <p>I developed a react native iOS app which saves/loads data into/from keychain via <a href="https://github.com/mCodex/react-native-sensitive-info/blob/master/ios/RNSensitiveInfo/RNSensitiveInfo.m" rel="nofollow noreferrer">https://github.com/mCodex/react-native-sensitive-info/blob/master/ios/RNSensitiveInfo/RNSensitiveInfo.m</a></p>
  
  <p>My read/write keychain options is below, it never changes and works well since day1</p>
  
  <pre><code>const defaultOptions: RNSensitiveInfoOptions = {
    touchID: true,
    kSecAccessControl: 'kSecAccessControlBiometryAny',
    kSecUseOperationPrompt: 'We will store data securely on your device.',
    sharedPreferencesName: 'sensitive',
    keychainService: 'sensitive',
  };
  </code></pre>
  
  <p>Recently one of my clients complain about the data cannot be retrieved from keychain because of <code>errSecNotAvailable                       = -25291,    /* No keychain is available. You may need to restart your computer. */</code></p>
  
  <p>I thought there might be something wrong happened to keychain, so I tried set a single key/value item with the same option (so the <code>kSecAttrService</code> and <code>kSecClass</code> are same with business related items): 'foo' -> 'bar'. And I can load this value out via the same option.</p>
  
  <p>I did more experiences:</p>
  
  <ol>
  <li><p>if I read a key doesn't exist, the keychain API will return error <code>errSecItemNotFound -25300</code></p></li>
  <li><p>if I read a business related key, the keychain API return error <code>errSecNotAvailable -25291</code></p></li>
  <li><p>I jailbreak this iPhone and use <a href="https://github.com/ptoomey3/Keychain-Dumper" rel="nofollow noreferrer">https://github.com/ptoomey3/Keychain-Dumper</a> to dump the items but it prompt (although the phone is unlock):</p></li>
  </ol>
  
  <pre><code>[INFO] No Generic Password Keychain items found.
  [HINT] You should unlock your device!
  </code></pre>
  
  <ol start="4">
  <li>I copied Keychain-2.db from device to local computer and using sqlite DB to query the generic password items, looks like they are there (but as they are encrypted, i am not sure 100%):
  <a href="https://i.stack.imgur.com/WSHOk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WSHOk.png" alt="enter image description here"></a></li>
  </ol>
  
  <p>I am expecting someone could suggest:</p>
  
  <ol>
  <li>why this issue could happen?</li>
  <li>is there any possibility I can restore the keychain data?</li>
  </ol>