- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们有一个信息亭应用程序,我们在其中使用 idleTimerDisabled
来防止屏幕在工作时间关闭,并让它在晚上关闭。
我使用在 applicationDidBecomeActive
方法中创建的计时器执行此操作:
self.screenLockTimer = [NSTimer scheduledTimerWithTimeInterval:300 target:self selector:@selector(setupScreenLock) userInfo:nil repeats:YES];
-
- (void)setupScreenLock {
NSDate *currentDate = [NSDate date];
NSDate *closingDate = [[NSCalendar currentCalendar] dateBySettingHour:17 minute:0 second:0 ofDate:currentDate options:0];
BOOL isOpeningHours = [currentDate compare:closingDate] == NSOrderedAscending;
[UIApplication sharedApplication].idleTimerDisabled = isOpeningHours;
}
在我们开始使用Autonomous Single App Mode 之前,这曾经工作得很好。现在屏幕不再在晚上关闭。对此有解释(和解决方法)吗?我知道 iOS 12 中存在一个错误,其中 idleTimerDisabled
不再适用于引导访问,但我还没有看到关于单一应用模式的类似问题的报告。
最佳答案
触发 native 操作可能会“解决”问题。我能够使用下面的代码解决我的问题。
尝试使用以下代码:
[UIApplication sharedApplication].idleTimerDisabled = isOpeningHours;
// Guided access idle timer fix
UITextField *textField = [[UITextField alloc] init];
[self.view addSubview:textField]; // self.view or whatever relevant view is accessible.
[textField becomeFirstResponder];
[textField resignFirstResponder];
[textField removeFromSuperView];
关于ios - idleTimerDisabled 不适用于(自主)单一应用程序模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55813336/
我正在使用 [[UIApplication sharedApplication] setIdleTimerDisabled: YES]; 防止应用程序进入空闲状态,但是当我发出时 [[UIApplic
我的 iPhone 应用程序有两种状态:UI 和 Game。游戏仅使用设备倾斜来玩,所以我在游戏开始时关闭了自动休眠: [[UIApplication sharedApplication].idleT
我不确定下面的代码在 appdelegate 的 didFinishLaunchingWithOptions 中是如何工作的? [[UIApplication sharedApplication] a
我们有一个信息亭应用程序,我们在其中使用 idleTimerDisabled 来防止屏幕在工作时间关闭,并让它在晚上关闭。 我使用在 applicationDidBecomeActive 方法中创建的
我有一个 iPad 调查工具作为内部企业应用程序。我通过在应用程序委托(delegate)的 didFinishLaunchingWithOptions 设置 [[UIApplication shar
我必须在 iPad 上下载一个非常大的文件。 (iOS5, iOS6) 为了防止 iPad 屏幕进入休眠状态,我使用: [UIApplication sharedApplication].idleTi
我用过: [UIApplication sharedApplication].idleTimerDisabled = YES; 在 iPhone OS 2.x 下开发和运行的许多应用程序中从未出现过任
我有一个应用程序,如果它有前台,它可以从硬件附件接收定期更新。该硬件配件上有一个物理硬件按钮。用户将此视为“与设备的交互”(在这种情况下为 iPhone 或 iPad touch),我希望这些硬件按钮
我是一名优秀的程序员,十分优秀!