1

I am implementing touch Id feature In my application. It's working fine for touchID using evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics

I also want to use pass-code option which is alternate for Touch Id, I am referring per apple's demo code for passcode using keychain. Apple Sample Code link

Can't we use it without adding any item using method addItemAsync to ask for passcode? Is there any alternate way to ask device's passcode in our application programmatically?

If I try to use without add, getting error errSecItemNotFound. Please suggest Am I missing anything or we can do with any other way to use device's passcode for our application,

1 Answer 1

1

If you want to read an item from the keychain you have to write it first. If the item isn't there then, as you discovered, you will get errSecItemNotFound - because the item wasn't found.

You simply need to add an item to the keychain when you first run your app - this will then give you an item to authenticate against.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for your reply. Ok, Yes that I got what you mean. But actually I want to use passcode which user has set for device from setting of touch id. So to use that passcode I have to add item compulsary as in apple's sample code? OR any other way to use it without add? Please suggest.
Yes, you can only use the passcode to unlock an item from the keychain - it isn't available for general-purpose authentication
Okay, one last question. Suppose we use like add item and unlock then It will ask for device passcode. So we can say it's general purpose use of passcode. Can apple reject app with this kind of implementation?
Only Apple can say for sure, but I don't think so. You aren't using private APIs. You are using it access data from the keychain. Whether or not you use the value from the keychain shouldn't matter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.