我的应用使用Touch ID,但如果用户尚未启用它,我目前要求他们手动打开“设置”应用并向下滚动至“Touch ID”项。
有没有办法直接将它们链接到我的应用中的触摸ID设置页面?
(请注意,我不想在顶层打开“设置”应用,或按照is it possible to open Settings App using openURL?中的说明打开应用的原生设置页面。)
Cordova插件非常理想,但任何iOS系统调用的文档都会很棒。
答案 0 :(得分:2)
Apple更改了在“设置”中打开特定菜单的方式。 iOS 10的方案价值是 " App-Prefs:" 。但也许它会在下一个版本中改变。
您可以尝试在一个周期中打开不同的网址。 请记住,iOS 7中未定义常量 UIApplicationOpenSettingsURLString (如果您支持此版本)。
请查看我的代码。它适用于iOS 10及更低版本。
<ion-item>
<ion-label style="color: black;" fixed>User Name</ion-label>
<ion-input type="text" name="username" ngModel #userName="ngModel"
required pattern="[A-Za-z0-9]{3}"></ion-input>
</ion-item>
<div *ngIf="userName.errors?.required && userName.touched">
Name is required
</div>
<div *ngIf="userName.errors?.pattern && userName.touched">
Not valid
</div>
答案 1 :(得分:0)
可悲的是,无法打开Touch ID页面。
修改强> 在iOS 10下再次更改,请检查以下答案。
答案 2 :(得分:0)
这对我有用:
NSURL* url = [NSURL URLWithString:@"prefs:root=TOUCHID_PASSCODE"];
[[UIApplication sharedApplication] openURL:url];
编辑:我认为这只有效,因为我安装了一个注册了prefs URL方案的app(Launcher)。通过执行以下操作在我的plist中配置CFBundleURLTypes后,我在我自己的应用程序中注册了此方案后,上面只适用于没有安装此应用程序的设备:
target -> Info -> URL Types -> (add) -> URL Schemes = "prefs"