Pregunta

After a lot of rumors, Apple has announced the new iPhone 5s will have a biometric fingerprint sensor (Touch ID).

Has apple already released the API/SDK for this sensor? If so, can an example be provided?

¿Fue útil?

Solución

Update iOS >= 8

As of iOS 8, the old part of this answer is no longer true. Apple has introduced the Local Authentication Framework, which allows you to utilize Touch ID in your applications

Quote + Sample code (Local Authentication Framework Reference)

The Local Authentication framework provides facilities for requesting authentication from users with specified security policies. For example, to request that the user authenticate using Touch ID you would use code such as this:

LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = <#String explaining why app needs authentication#>;

if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
    [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
                  localizedReason:myLocalizedReasonString
                            reply:^(BOOL succes, NSError *error) {
            if (success) {
                // User authenticated successfully, take appropriate action
            } else {
                // User did not authenticate successfully, look at error and take appropriate action
            }
        }];
} else {
    // Could not evaluate policy; look at authError and present an appropriate message to user
}

Old answer iOS < 7

From the September 10, 2013 keynote approximately 61 minutes into the presentation:

All fingerprint info is encrypted and stored inside the secure enclave in our new A7 chip. Here, it is locked away from everything else, accessible only by the Touch ID sensor. It’s never available to other software, it’s never stored on Apple’s servers or backed up to iCloud.

As of yet, this is all the information that is available. That being said, this is speculation, but I think it's likely that there won't be an API for this. If anything, usage of the sensor, will only be done through interaction with the keychain allowing the OS to interact with the sensor, while keeping your app separate in its cozy little sandbox.

EDIT:

It looks like it's true that we can't access the sensor. Here's a quote from an ALLThingsD article (linked below).

Apple Senior Vice President Phil Schiller confirmed to AllThingsD that developers won’t get access to use a fingerprint as a means of authentication. He declined to comment on whether that might come in the future.

http://allthingsd.com/20130910/iphone-developers-wont-get-fingerprint-reader-authentication-option-for-now-anyway/

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top