yankodimitrov / SwiftPasscodeLock

An iOS passcode lock with TouchID authentication written in Swift.
MIT License
681 stars 263 forks source link

Bug: TouchID not showing when Passcode enabled #15

Closed gblotter closed 9 years ago

gblotter commented 9 years ago

If I toggle the passcode switch to 'on', set a passcode, and then leave the app. Upon returning, I'm greeted with the new passcode, but no touchID authentication modal. I have to kill the app, and then enter it to get the touchID authentication modal to present.

ziogaschr commented 9 years ago

I think this is because the passcodeLockPresenter is lazy initiated without touchID support on first app launch. I was able to handle that by making the passcodeViewController public and then changing its properties from the app while Passcode is set.

I can add an example on this @gblotter if you want. But I was thinking that @yankodimitrov will handle this in the swift-2.0 branch differently.

yankodimitrov commented 9 years ago

Could someone test for that on the new version?

Thanks!

gblotter commented 9 years ago

So here is what I'm seeing:

Same behavior that I originally described. Additionally, once the passcode is set, kill the app. Open the app and the TouchID authentication is presented. Hit the home button, go into the app again, and now just the passcode, no TouchID authentication is presented.

Of course in each of these scenarios you can tap the 'Use TouchID" button to bring it up. I'm just not sure if that is your intended behavior.

yankodimitrov commented 9 years ago

It seems that this is the intended behaviour by the system:

LAErrorSystemCancel

Authentication was canceled by system—for example, if another application came to foreground while the authentication dialog was up.

gblotter commented 9 years ago

Right... I believe that just means that it needs to be implemented differently, i.e. when the applicationDidEnterBackground() method is called, it's throwing up the passcode lock screen. Somehow the applicationWillEnterForeground() method need to be used?

I know that other apps do it just fine... BUT... Those are just my thoughts. If this is "good enough" for now, that's cool. You're the author, designer, and decision maker :)

yankodimitrov commented 9 years ago

I have never said that it is good enough. As currently I cannot test on a device with TouchID it is somehow hard for me to fix the issue and I will leave it open for now. Also any PRs are welcome.

ziogaschr commented 9 years ago

@yankodimitrov this is why I have moved some of the logic in the old project in applicationWillEnterForeground. When I will install Swift 2.0, I will try to suggest a PR.

yankodimitrov commented 9 years ago

Could someone test my latest commit (not the latest release) with the TouchID request fix on a device with TouchID?

If everything is working properly I will publish a new release.

Thanks!

yankodimitrov commented 9 years ago

The new simulator found in Xcode 7 GM can simulate TouchID authentication. Just tested and fixed the issue.

Check out the release version 1.0.1

Thanks!