在我的iOS應用程序中有一個登錄頁面來訪問features.I要直接登錄我的註冊指紋。如果有人知道這個功能,請幫助我。如何添加指紋登錄到iOS應用程序
回答
首次進口,
#import <LocalAuthentication/LocalAuthentication.h>
然後寫.M代碼
- (IBAction)authenicateButtonTapped:(id)sender {
LAContext *context = [[LAContext alloc] init];
NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"Are you the device owner?"
reply:^(BOOL success, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"There was a problem verifying your identity."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
return;
}
if (success) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"You are the device owner!"
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"You are not the device owner."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
});
}];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Your device cannot authenticate using TouchID."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
}
我沒有在登錄頁面 –
添加任何身份驗證按鈕,然後請在您的LogInVC ViewDidLoad後調用此代碼後避免第一線即IBAction方法他們做if(成功){//做的東西}行動 –
tq man U挽救了我的生命 –
我已經加入GitHub上https://github.com/sumitjain7/AppleTouchId/blob/master/appleTouchId/Classes/AppleAuthenticator.swift
庫目前豆莢,這是行不通的。你可以直接使用這個類。 你只需要做到這一點:
AppleAuthenticator.sharedInstance.authenticateWithSuccess({
let vc = self.storyboard?.instantiateViewController(withIdentifier: "YOUR_VC_IDENTIFIER")
//do your stuff here
}, failure:{ errorCode in
var authErrorString : NSString
switch (errorCode) {
case LAError.systemCancel.rawValue:
authErrorString = "System canceled auth request due to app coming to foreground or background.";
break;
case LAError.authenticationFailed.rawValue:
authErrorString = "User failed after a few attempts.";
break;
case LAError.userCancel.rawValue:
authErrorString = "User cancelled.";
break;
case LAError.userFallback.rawValue:
authErrorString = "Fallback auth method should be implemented here.";
break;
case LAError.touchIDNotEnrolled.rawValue:
authErrorString = "No Touch ID fingers enrolled.";
break;
case LAError.touchIDNotAvailable.rawValue:
authErrorString = "Touch ID not available on your device.";
break;
case LAError.passcodeNotSet.rawValue:
authErrorString = "Need a passcode set to use Touch ID.";
break;
default:
authErrorString = "Check your Touch ID Settings.";
break;
}
// self.presentAlertControllerWithMessage(authErrorString)
})
- 1. 登錄到iOS應用程序
- 2. 使用Foursquare登錄iOS應用程序
- 3. Facebook登錄iOS應用程序
- 4. 密碼登錄爲iOS應用程序
- 5. 將登錄頁面添加到現有的angular2應用程序
- 6. 將Facebook登錄添加到Angular2-Meteor應用程序
- 7. 應用程序啓動時應該如何登錄屏幕IOS
- 8. iOS應用登錄流程
- 9. iOS Facebook從Phonegap登錄應用程序崩潰應用程序
- 10. Android:如何將Google加入登錄到Android應用程序?
- 11. IOS應用程序如何做後註冊登錄頁面與指示
- 12. 如何使用loginClient(iOS應用程序)在YouTube上登錄
- 13. 如何將Facebook登錄界面添加到我的React Native應用程序中?
- 14. 如何將自定義登錄模塊添加到WebLogic應用程序?
- 15. 登錄與其他iOS應用程序(類似與Facebook登錄)
- 16. 「要登錄到此應用程序,必須將帳戶添加到domain.com目錄」
- 17. 如何將文件夾添加到iOS應用程序文檔目錄中?
- 18. 如何將UIWebView添加到我的iOS應用程序?
- 19. 如何將SQLite數據庫添加到iOS(CoreData)應用程序?
- 20. 如何添加多個頁面到我的IOS應用程序?
- 21. 如何將iOS「Open In ...」功能添加到應用程序
- 22. 如何從iOS應用程序登錄Django帳戶?
- 23. Twitter面料登錄iOS如何更改應用程序密鑰
- 24. 如何在iOS應用程序中登錄後重定向
- 25. 如何將觸摸指針添加到應用程序?
- 26. 如何指導圖像添加到應用程序在Android中
- 27. 在Cocoa Touch標籤欄前添加登錄屏幕IOS的應用程序
- 28. 如何-登錄C#應用程序
- 29. 如何使用devise,omniauth登錄到遠程rails應用程序
- 30. 應用程序與Facebook登錄登錄
https://developer.apple.com/documentation/ localauthentication/lacontext – Basheer
你到目前爲止嘗試過什麼? –