1 Reply
      Latest reply on Mar 30, 2016 7:53 AM by eskimo
      Govindaraj Level 1 Level 1 (0 points)


        We are using native keychain wrapper class to store and retrieve values from the keychain. But in some case the value is empty.

        We have the below items enabled in our app,

        1. Location service ON - Always state initially and user can change that in device settings (CLVisit and Significant location tracking was used).

        2. Background Fetch - ON - We are not using any specific method for this in code. (i.e performfetchwithcompletionhandler method not used/added in code )


        Whether the above scenario may have impact on keychain items or is there any other scenario which can cause keychain items to be deleted?

        • Re: Keychain sometimes return empty
          eskimo Apple Staff Apple Staff (13,935 points)

          In general keychain items do not just mysteriously disappear.  There are, however, various circumstances where keychain items can go away or become inaccessible.  Some of these are well documented, some less so.  For example:

          • app transfer

          • restoring from non-encrypted backup

          • API-level access control (kSecAttrAccessible and kSecAttrAccessControl)

          • the ongoing -34018 bug

          Based on the limited info you’ve posted, it’s hard to say what might be affecting your app.  To start, I recommend that you modify your app to capture and log keychain error codes.  That will give you some clue as to where to start your investigation.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"