Let's suppose that i have implemented an iOS web browser, capable of bidirectional communication with Javascript in the webview. What i would have to do if i wanted any iOS8 Action extensions to work in it, as it does in Mobile Safari? There is no problem in telling the webview to execute functions on the mandated ExtensionPreprocessingJS
object and get the callback result. But how do i even get hold of that NSExtensionJavaScriptPreprocessingFile
? I haven't found any iOS8 API which would allow me to enumerate the eligible app extensions. The less getting hold of their Info.plist
s and actually get the file out of the app extension's bundle content.
Through my test Action extension, i know that the whole extensionContext.inputItems
ever given to the extension is just and only what Apple Action extension doc says: a single NSItemProvider
under NSExtensionItemAttachmentsKey
, providing a single kUTTypePropertyList
with what the JS execution already returned. In other words, the JS must be known and executed even before beginRequestWithExtensionContext
is called.
Do i miss something or is it really impossible for 3rd party apps to do the same as Mobile Safari? It would make kind of sense from app access security point of view, but still... the keywords here are "modularity" and "extensibility", right? Is Mobile Safari treated a more equal animal than vanilla UI/WKWebView animals here? I mean, WKWebView
indeed has some neat new JS functionality (evaluate
completion handler, WKUserContentController
) but how do i wire it up with generic Action extension?