Keychain Query Always Returns errSecItemNotFound After Upgrading to iOS 13

前端 未结 5 1258
春和景丽
春和景丽 2021-01-31 09:01

I am storing passwords into the iOS keychain and later retrieving them to implement a \"remember me\" (auto-login) feature on my app.

I implemented my own wrapper aroun

5条回答
  •  孤街浪徒
    2021-01-31 09:26

    After half a day of experimentation I discovered that using a pretty basic instance of kSecClassGenericPassword I had the problem on both the simulator and real hardware. After having a read over of the docs I noticed that kSecAttrSynchronizable has a kSecAttrSynchronizableAny. To accept any value for any other attribute, you simply don't include it in the query. That's a clue.

    I found that when I included kSecAttrSynchronizable set to kSecAttrSynchronizableAny the queries all worked. Of course I could also set it to either kCFBooleanTrue (or *False) if I actually do want to filter on that value.

    Given that attribute everything seems to work as expected for me. Hopefully this will save some other people a half day of mucking around with test code.

提交回复
热议问题