When you call completeRequest(returningItems:completionHandler:)
from an extension, where does this get handled by the host app?
问题:
回答1:
Disclaimer: did not checked my assumptions, but may be this helps.
1) documentation states:
Call the completeRequestReturningItems:completionHandler: method, which signals the host app that its original request is complete
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) "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
documentation says about this property:
Upon the completion of an activity, or the dismissal of the activity view controller, the view controller’s completion block is executed.
and:
returnedItems - An array of NSExtensionItem objects containing any modified data. Use the items in this array to get any changes made to the original data by an extension
Again, I did not test it. But this property looks like handler you looks for.