[英]How to check whether user has enabled/checked autofill credential provider extension or not from phone settings in iOS?
I have implemented AutoFill Credential Provider Extension
in iOS.我已经在 iOS 中实现了AutoFill Credential Provider Extension
。
Everything is working fine but I am having one issue, not exactly an issue but I am unable to achieve the below functionality.一切正常,但我有一个问题,不完全是一个问题,但我无法实现以下功能。
I want to get Autofill
extension state every time when user open a specific viewController
of my application.每次当用户打开我的应用程序的特定视图控制器时,我都想获得Autofill
扩展viewController
。
So that I am able check whether it's enabled from settings or not.这样我就可以检查它是否从设置中启用。
If it is not enabled I will navigate user to phone settings otherwise user can use the app.如果未启用,我会将用户导航到手机设置,否则用户可以使用该应用程序。
As documented we need to use ASCredentialIdentityStore
state for that purpose:如文件所述,我们需要为此目的使用ASCredentialIdentityStore
state:
so you can add somewhere the following wrapped async call and use it to validate of extension is enabled:因此您可以在某处添加以下包装的异步调用并使用它来验证扩展是否启用:
- (void)checkExtesionEnabledWithCompletion:(void(^)(BOOL))completion {
ASCredentialIdentityStore *store = [ASCredentialIdentityStore sharedStore];
[store getCredentialIdentityStoreStateWithCompletion:^(ASCredentialIdentityStoreState * _Nonnull state) {
completion(state.isEnabled);
}];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.