本文介绍了主机应用程序在哪里处理NSExtensionContext#completeRequest?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您从分机呼叫completeRequest(returningItems:completionHandler:)时,主机应用程序在哪里处理?

When you call completeRequest(returningItems:completionHandler:) from an extension, where does this get handled by the host app?

推荐答案

免责声明:没有检查我的假设,但这可能会有所帮助.

Disclaimer: did not checked my assumptions, but may be this helps.

1)文档指出:

2)此处-图2-3显示了"Host" -app-是使用扩展名开始工作的应用程序.例如,主机"可以是用户触摸共享"按钮的应用程序.然后,此主机"应用将一些数据(用户要共享)发送给扩展程序.

2) here - Figure 2-3 shows that "Host"-app - is app that starts some work with extension. For example, "Host" may be the app in which user touches "Share"-button. Then this "Host"-app sends some data (which user wants to share) to extension.

3)我认为,共享数据"扩展是非常常见的扩展示例.很有可能UIActivityViewController中的某处必须是实现您正在寻找的completeRequest(returningItems:completionHandler:)以及从扩展名调用的completeRequest(returningItems:completionHandler:)的方式.这就是我发现的:

3) "Sharing data"-extension, I think, very common example of extension. So very probable that somewhere in UIActivityViewController must be way to realise completeRequest(returningItems:completionHandler:) that you looking for and that called from extension.And this is what I found:

@property(nullable, nonatomic, copy) UIActivityViewControllerCompletionWithItemsHandler completionWithItemsHandler NS_AVAILABLE_IOS(8_0); // set to nil after call

文档关于此属性的说法:

和:

再次,我没有测试.但是此属性看起来就像您要查找的处理程序.

Again, I did not test it. But this property looks like handler you looks for.

这篇关于主机应用程序在哪里处理NSExtensionContext#completeRequest?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 08:31