- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在使用 3D Touch 动态快速操作快捷方式时遇到了一个非常简单的问题。
我希望在应用程序终止时清除快捷方式(通过双击主页按钮并向上滑动)。
我调用 UIApplication.sharedApplication().shortcutItems.removeAll()
如下:
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
UIApplication .sharedApplication().shortcutItems?.removeAll()
self.saveContext()
}
但没有任何效果,使用 3D touch 时仍然显示快速操作。
如果我将 UIApplication.sharedApplication().shortcutItems?.removeAll()
放在里面 func applicationDidEnterBackground(application: UIApplication)
,这完全符合预期……
我阅读了一些关于 applicationDidEnterBackground
的内容,这是由于后台处理或其他原因在大多数情况下使用的功能......但是当用户使用终止应用程序时,必须有一种方法来实现我想要的向上滑动应用程序监视器。
谢谢
最佳答案
没试过。但是这个调整应该有效。在 applicationWillTerminate 上启动后台任务,并在一些小的延迟后结束它。同时,您可以调用“UIApplication .sharedApplication().shortcutItems?.removeAll()”。这有望清除快捷方式项目。
关于Swift:在应用程序退出时清除 .sharedApplication().shortcutItems,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34790495/
我在使用 3D Touch 动态快速操作快捷方式时遇到了一个非常简单的问题。 我希望在应用程序终止时清除快捷方式(通过双击主页按钮并向上滑动)。 我调用 UIApplication.sharedApp
我正在阅读有关为支持 3dTouch 的设备的主屏幕添加动态快捷方式的信息。它本质上归结为读/写 shortcutItems UIApplication.sharedApplication 的成员数组
我有一个应用程序使用 3d touch 跳转到我应用程序中的某个 VC。问题是当应用程序正常启动时,我所有的 VC 都嵌入到导航 View Controller 中。但是由于我跳过启动序列并直接跳转到
我是一名优秀的程序员,十分优秀!