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?
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?
从 iOS 8 开始,这个答案的旧部分不再正确。Apple 引入了本地身份验证框架,允许您在应用程序中使用 Touch ID
引用+示例代码(本地认证框架参考)
本地身份验证框架提供了向具有指定安全策略的用户请求身份验证的设施。例如,要请求用户使用 Touch ID 进行身份验证,您可以使用如下代码:
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
}
从2013 年 9 月 10 日的主题演讲开始大约 61 分钟后:
所有指纹信息都经过加密并存储在我们新 A7 芯片的安全区域内。在这里,它与其他一切都被锁定,只能通过 Touch ID 传感器访问。其他软件永远无法使用它,它永远不会存储在 Apple 的服务器上或备份到 iCloud。
到目前为止,这就是所有可用的信息。话虽如此,这是猜测,但我认为很可能不会有用于此的 API。如果有的话,传感器的使用只能通过与钥匙串的交互来完成,允许操作系统与传感器进行交互,同时将您的应用程序独立于其舒适的小沙箱中。
Apple 高级副总裁 Phil Schiller 向 AllThingsD 证实,开发人员将无法使用指纹作为身份验证手段。他拒绝评论未来是否会出现这种情况。