Local Authentication Succeeds with Any Non-Empty Passcode on Simulator?
<p><em>(Related to <a href="https://stackoverflow.com/questions/25459059/is-there-any-way-to-use-apples-touch-id-fingerprint-scanner-on-ios-simulator">this (a bit outdated) question</a>, but not the same.)</em></p>
<h3>Background</h3>
<p>Xcode 7.2, iOS 9.2. I am updating some local authentication/keychain demo projects I did back then, to Swift 2.</p>
<p>I put the code below together and tested it on the simulator:</p>
<pre><code>override func viewDidAppear(animated: Bool)
{
    super.viewDidAppear(animated)
    
    var error: NSError?

    let context = LAContext()
    
    
    guard context.canEvaluatePolicy(.DeviceOwnerAuthentication, error: &amp;error) else {
        print(&quot;Can not evaluate policy&quot;)
        return
    }
    
    context.evaluatePolicy(.DeviceOwnerAuthentication,
        localizedReason: &quot;Authenticate!&quot;,
        reply: { (success, error) -&gt; Void in
            
            if success {
                print(&quot;SUCCESS&quot;)
            }
            else{
                switch LAError(rawValue: error!.code)! {
                case .AuthenticationFailed:
                    break
                case .UserCancel:
                    break
                case .UserFallback:
                    break
                case .SystemCancel:
                    break
                case .PasscodeNotSet:
                    break
                case .TouchIDNotEnrolled:
                    break
                default:
                    break
                }
            }
        }
    )
}
</code></pre>
<p>To my surprise, when I run this code on the &quot;iPhone 5&quot; or &quot;iPhone 5s&quot; simulators, the &quot;Alphanumeric passcode&quot; screen appears:</p>
<p><a href="https://i.stack.imgur.com/IQ9to.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IQ9to.png" alt="enter image description here" /></a></p>
<p>(<em>there is no &quot;Touch ID &amp; Passcode&quot; section in Settings.app for the simulator. Also, &quot;Touch ID Enrolled&quot; is <strong>unchecked</strong> in the Simulator's OSX menu</em>)</p>
<p>If I tap the <strong>Cancel</strong> button (i.e., the &quot;return&quot; button while the password field is empty), authentication fails as expected (execution jumps to <code>case .UserCancel:</code> in the code above).</p>
<p>But if I type anything, the <strong>Cancel</strong> button will change to <strong>Done</strong>, and tapping it will cause authentication to succeed.</p>
<p><em>(If I enable <code>Hardware &gt; Touch ID Enrolled</code>, the <code>Simulate Finger Touch &gt;</code> works as expected.)</em></p>
<h3>Questions:</h3>
<ul>
<li>Is there a way (that I'm missing) to set a <strong>specific passcode</strong>, and check against that? (instead of &quot;anything passes validation&quot;)</li>
<li>Is there a way to choose 4-digit passcode, 6-digit passcode, etc. instead of the complex password format I'm seeing now?</li>
</ul>