静音3D触控快速动作 [英] Silent 3D Touch Quick Action

查看:130
本文介绍了静音3D触控快速动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从新的iPhone 6s/6s +的新3D Touch功能开始,我正在尝试向我的应用添加一些主屏幕快速操作.

As of the new 3D Touch capabilities with the new iPhone 6s/6s+, I'm trying to add some home screen quick actions to my app.

我能够实现正常的力流,使其轻触主屏幕上的应用程序图标->选择可用的快速操作之一->在所有可能的应用程序状态下妥善处理它.

I was able to implement the normal flow of force touching the app's icon in the home screen -> choose one of the quick actions available -> taking care of it properly in all possible app states.

我的问题是:是否可以在可用的快速操作中创建静默操作?我所说的silent表示将要执行某些操作,但是该应用程序将无法完成启动吗?还是选择启动但不会处于前台?

My question is: Is it possible to create a silent action among the available quick actions? By silent I mean that a certain action will take place, yet the app won't complete its launch? Or alternatively launch but won't be in foreground?

更新
我将详细说明我要实现的目标-我希望其行为与背景交付的HealthKit产品类似-在商店发生变化时,HealthKit会唤醒我的应用并给我机会某些东西在后台(以HealthKit示例为例-查询商店中的新数据).

UPDATE
I'll elaborate on what I'm trying to achieve - I want to have similar behaviour to the one HealthKit offer with its background delivery - where upon a change in the store, HealthKit wakes my app and give me a chance to do something in the background (with HealthKit example - query for the new data in the store).

在阅读了有关该主题的许多Apple文档后,我感到当前的API无法实现-但我希望有人会令我惊讶...

After reading much of Apple's documentation on the topic I have the feeling it is not possible with the current API available - but I hope someone will surprise me...

推荐答案

不是.用户调用主屏幕快速操作始终会激活该应用程序.

Nope. The user invoking a home screen Quick Action always activates the app.

如果您的应用程序已经在运行并且已被挂起,那么它就会浮出水面,并且您的应用程序代表会获得

If your app was already running and is suspended, it comes to the foreground and your app delegate gets the 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: message. (So, your did/willFinishLaunching handler needs to check the options dictionary for the possibility of launch via quick action.)

无论哪种方式,您的应用程序都将成为前台.

Either way, your app comes to the foreground.

这篇关于静音3D触控快速动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆