Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法阻止应用程序进入后台?或者有没有办法让我的应用程序进入后台?
我正在为客户制作一个展示应用程序,该应用程序必须始终在 iPad 上运行,无需用户交互。
您可以使用以下代码强制您的应用保持活动状态
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
但是,如果您按下设备的主页按钮,该应用程序将进入后台。你不能强行阻止它。
UILocalNotification在这种情况下,如果设备被锁定、出现通知并且用户解锁设备或用户点击通知,您可以使用 将应用程序置于前台。
UILocalNotification
applicationDidEnterBackground:每当用户在方法 中进入后台时,您还可以触发本地通知
applicationDidEnterBackground: