静音 3D Touch 快速操作
Silent 3D Touch Quick Action
随着新 iPhone 6s/6s+ 的新 3D Touch 功能,我正在尝试向我的应用添加一些主屏幕快速操作。
我能够实现在主屏幕中触摸应用程序图标的正常力流 -> 选择可用的快速操作之一 -> 在所有可能的应用程序状态下妥善处理。
我的问题是:是否可以在可用的快速操作中创建静默操作? silent
我的意思是某个动作将会发生,但应用程序不会完成启动?或者启动但不会在前台?
更新
我将详细说明我要实现的目标 - 我希望在后台交付时具有与 HealthKit
提供类似的行为 - 在商店发生变化时,HealthKit 会唤醒我的应用程序并给我一个机会在后台做一些事情(以 HealthKit 为例 - 查询商店中的新数据)。
在阅读了有关该主题的大量 Apple 文档后,我觉得当前 API 可用是不可能的 - 但我希望有人会给我惊喜...
没有。用户调用主屏幕快速操作 总是 激活应用程序。
如果您的应用程序已经 运行 并被暂停,它会进入前台并且您的应用程序委托会收到 application:performActionForShortcutItem:completionHandler:
message. If your app has not been running (i.e. has not been run since install, or was previously backgrounded/suspended but later purged from memory), it launches and your app delegate gets the application:didFinishLaunchingWithOptions:
message and then the application:performActionForShortcutItem:completionHandler:
消息。 (因此,您的 did
/willFinishLaunching
处理程序需要检查选项字典以了解通过快速操作启动的可能性。)
无论哪种方式,您的应用都会出现在前台。
随着新 iPhone 6s/6s+ 的新 3D Touch 功能,我正在尝试向我的应用添加一些主屏幕快速操作。
我能够实现在主屏幕中触摸应用程序图标的正常力流 -> 选择可用的快速操作之一 -> 在所有可能的应用程序状态下妥善处理。
我的问题是:是否可以在可用的快速操作中创建静默操作? silent
我的意思是某个动作将会发生,但应用程序不会完成启动?或者启动但不会在前台?
更新
我将详细说明我要实现的目标 - 我希望在后台交付时具有与 HealthKit
提供类似的行为 - 在商店发生变化时,HealthKit 会唤醒我的应用程序并给我一个机会在后台做一些事情(以 HealthKit 为例 - 查询商店中的新数据)。
在阅读了有关该主题的大量 Apple 文档后,我觉得当前 API 可用是不可能的 - 但我希望有人会给我惊喜...
没有。用户调用主屏幕快速操作 总是 激活应用程序。
如果您的应用程序已经 运行 并被暂停,它会进入前台并且您的应用程序委托会收到 application:performActionForShortcutItem:completionHandler:
message. If your app has not been running (i.e. has not been run since install, or was previously backgrounded/suspended but later purged from memory), it launches and your app delegate gets the application:didFinishLaunchingWithOptions:
message and then the application:performActionForShortcutItem:completionHandler:
消息。 (因此,您的 did
/willFinishLaunching
处理程序需要检查选项字典以了解通过快速操作启动的可能性。)
无论哪种方式,您的应用都会出现在前台。