Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用密码或TouchID锁定特定应用程序_Ios_Objective C_Iphone - Fatal编程技术网

Ios 使用密码或TouchID锁定特定应用程序

Ios 使用密码或TouchID锁定特定应用程序,ios,objective-c,iphone,Ios,Objective C,Iphone,我想用密码或TouchID锁定facebook、whatsapp等特定应用程序,这样未经授权的用户就无法访问我想要保护的应用程序 我在web上找不到任何方法,不确定是否可以锁定任何特定的应用程序?在应用程序开始时实现登录屏幕,对于touchID(touchID为iOS8+),您可以使用以下代码: LAContext *context = [[LAContext alloc] init]; context.localizedFallbackTitle = @"Enter PIN"; [contex

我想用密码或TouchID锁定facebook、whatsapp等特定应用程序,这样未经授权的用户就无法访问我想要保护的应用程序


我在web上找不到任何方法,不确定是否可以锁定任何特定的应用程序?

在应用程序开始时实现登录屏幕,对于touchID(touchID为iOS8+),您可以使用以下代码:

LAContext *context = [[LAContext alloc] init];
context.localizedFallbackTitle = @"Enter PIN";
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"PIN Authentication" reply:^(BOOL success, NSError *error) {
   if (success)
   {
      //success, let's get started!
   }
   else if (error.code == LAErrorUserCancel)
   {
     NSLog(@"Authentication failed: %@", @"TouchID authentication cancelled");               
   }
   else if (error.code == LAErrorAuthenticationFailed) 
   {
      NSLog(@"Authentication failed: %@", @"TouchID authentication failed");
   }
   else if (error.code == LAErrorUserFallback) 
   {
      NSLog(@"Authentication failed: %@", @"TouchID authentication pin authentification fallback selected");
   }
   else if (error.code == LAErrorSystemCancel) 
   {
      NSLog(@"Authentication failed: %@", @"Touch authentication was canceled by system (e.g. another application went to foreground).");                
   }
   else if (error.code == LAErrorPasscodeNotSet) 
   {
      NSLog(@"Authentication failed: %@", @"Touch authentication could not start, because passcode is not set on the device.");
   }
   else if (error.code == LAErrorTouchIDNotAvailable) 
   {
      NSLog(@"Authentication failed: %@", @"Touch authentication could not start, because Touch ID is not available on the device.");
   }
   else if (error.code == LAErrorTouchIDNotEnrolled) 
   {
      NSLog(@"Authentication failed: %@", @"Touch authentication could not start, because Touch ID has no enrolled fingers.");
   }
   else 
   {
      NSLog(@"Authentication failed: %@", @"Touch ID has not been setup or system has cancelled");                
   }
}];

我无意使用TouchID或密码来保护我自己的应用程序。@IrfanGul在iOS中,应用程序在沙箱中运行,您对其他应用程序和iOS操作系统的某些资源的访问非常有限,但您无法更改它们的行为方式。换句话说,你不能影响其他应用的启动机制。至少在官方操作系统上是不可能的,越狱版本也是可能的。。