au WALLETのように、Touch IDダイアログからパスコード入力画面に移れるようにするには
iOSでau WALLETというアプリに、Touch IDを利用する認証画面があります。
そこで直接パスコードを入力してロックを解除することもできます。
ここでTouch IDから出す「パスコード直接入力ビュー」とはカスタマイズで実装したものですか?
iPhoneのシステムロック画面ですか?
ネットで色々調べましたがシステムのロック画面を呼び出す方法はなさそうです。
===============================
テスト用で実装したソースを共有致します。
参照:
[参照1]https://developer.apple.com/library/ios/samplecode/KeychainTouchID/Introduction/Intro.html
[参照2]https://www.secsign.com/fingerprint-validation-as-an-alternative-to-passcodes/
// show the authentication UI with our reason string
LAContext *context = [[LAContext alloc] init];
__block NSString *msg;
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:NSLocalizedString(@"UNLOCK_ACCESS_TO_LOCKED_FATURE", nil) reply:
^(BOOL success, NSError *authenticationError) {
if (success) {
msg =[NSString stringWithFormat:NSLocalizedString(@"EVALUATE_POLICY_SUCCESS", nil)];
} else {
msg = [NSString stringWithFormat:NSLocalizedString(@"EVALUATE_POLICY_WITH_ERROR", nil), authenticationError.localizedDescription];
if (authenticationError.code == LAErrorUserFallback) {
// The identifier and service name together will uniquely identify the keychain entry.
NSString * keychainItemIdentifier = @"fingerprintKeychainEntry";
NSString * keychainItemServiceName = @"com.secsign.secsign";
// Determine a string which the device will display in the fingerprint view explaining the reason for the fingerprint scan.
NSString * secUseOperationPrompt = @"Authenticate for server login";
// The keychain operation shall be performed by the global queue. Otherwise it might just nothing happen.
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
// Create the keychain query attributes using the values from the first part of the code.
NSMutableDictionary * query = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
(__bridge id)(kSecClassGenericPassword), kSecClass,
keychainItemIdentifier, kSecAttrAccount,
keychainItemServiceName, kSecAttrService,
secUseOperationPrompt, kSecUseOperationPrompt,
nil];
// Start the query and the fingerprint scan and/or device passcode validation
CFTypeRef result = nil;
OSStatus userPresenceStatus = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
// Ignore the found content of the key chain entry (the dummy password) and only evaluate the return code.
if (noErr == userPresenceStatus)
{
NSLog(@"Fingerprint or device passcode validated.");
}
else
{
NSLog(@"Fingerprint or device passcode could not be validated. Status %d.", (int) userPresenceStatus);
}
// To process the result at this point there would be a call to delegate method which
// would do its work like GUI operations in the main queue. That means it would start
// with something like:
// dispatch_async(dispatch_get_main_queue(), ^{
});
}
}
[self printResult:self.textView message:msg];
}];