6

我使用 Apple Configurator 将少数设备设置为受监督设备。但是,我无法使用UIAccessibilityRequestGuidedAccessSession API 让应用程序成功进入单应用程序模式。

我创建了一个在 Meraki 控制台中设置了限制的配置文件,特别是我将 Meraki 控制台中的“允许的单一应用程序模式”字段设置为我的应用程序包 ID。

我假设 Meraki 中的这个字段映射到autonomousSingleAppModePermittedAppIDs配置键。我添加了要安装在受监督设备上的 IPA(不是从应用商店安装)的应用。

配置文件和应用程序已成功安装在 iPad 上,但调用UIAccessibilityRequestGuidedAccessSession()仍然失败。

调用本身非常简单:

NSLog(@"requesting guided access");
UIAccessibilityRequestGuidedAccessSession(YES, ^(BOOL didSucceed) {
    if (didSucceed) {
        NSLog(@"entered guided access");
        self.inGuidedSessionMode = YES;
        [[[UIAlertView alloc] initWithTitle:@"entered single access mode" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
    }
    else {
        NSLog(@"failed to enter guided access");
        [[[UIAlertView alloc] initWithTitle:@"Unable to enter single access mode" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
    }
});

设备日志显示以下条目

Mar 26 11:42:31 BayLeaf-Kiosk-4 backboardd[28] <Error>: HID: The 'Passive' connection 'xxxxxx' access to protected services is denied.
Mar 26 11:42:31 BayLeaf-Kiosk-4 xxxxxx[412] <Warning>: requesting guided access
Mar 26 11:42:31 BayLeaf-Kiosk-4 xxxxxx[412] <Warning>: viewDidLoad got called
Mar 26 11:42:31 BayLeaf-Kiosk-4 xxxxxx[412] <Warning>: applicationDidBecomeActive called
Mar 26 11:42:31 BayLeaf-Kiosk-4 xxxxxx[412] <Warning>: failed to enter guided access
Mar 26 11:42:31 BayLeaf-Kiosk-4 backboardd[28] <Error>: HID: The 'Rate Controlled' connection 'xxxxxx' access to protected services is denied.

有没有人能够成功让他们的应用程序进入引导访问?我唯一能想到的是我的应用不在应用商店中,或者指定的捆绑 ID 不正确,但我找不到导出 Meraki 创建的 .mobileconfig 以验证它是否与我的应用匹配的方法。

对此我真的束手无策。我在想也许 Microsoft Surface(它也有一个与帐户相关联的应用程序模式)可能只是更容易做的事情。

将不胜感激任何帮助。谢谢!

PS:通过@zeiteisen 链接回复,这对让我了解这一点非常有帮助。

更新:我很确定捆绑 ID 是正确的,如果我在同一配置文件中使用我的应用名称/捆绑 ID 作为单一应用模式设置的值,我的应用会立即进入单一应用模式(这不是我想要,我希望它以编程方式进入/退出单个应用程序模式而不是被锁定)。

更新2:目前还不清楚具体的更改解决了这个问题,我只是从 Meraki 中删除了该应用程序,删除了我的配置文件,然后将它们重新添加,一旦 Meraki 推送了配置文件和应用程序,它就可以工作了。

4

2 回答 2

4

另外——我已经通过反复试验的方式了解到这一点——如果你尝试将应用程序锁定在viewDidLoador viewWillAppear/上viewDidAppear,它就不会起作用。我从您的日志中看到您正在尝试将应用程序锁定在viewDidLoad. 尝试使用计时器,也许这是你的问题。

[self performSelector:@selector(handleLockButton:) withObject:nil afterDelay:1];

当然,您需要将您的捆绑包 ID 列入可以将自己锁定为引导访问的应用程序的白名单。

快乐编码:)

Z。

于 2015-02-25T15:45:37.050 回答
0

确保您的配置文件看起来像这样,它应该可以正常工作:

<key>autonomousSingleAppModePermittedAppIDs</key>
<array>
    <string>org.mycompany.myapp</string>
</array>
于 2014-11-07T04:57:16.627 回答