I am developing a share extension for iOS 8 and it seem like i can run javascript code on page to grab some information like markup of the mage
But on the apple document it says that javascript code must be inside a .js file but my javascript code is coming from server and it is dynamic.
Is it possible to run javascript i downloaded from server or can I change js file contents everytime I need to use it?
You can't do this using the built-in support in the current share extension system.
The Javascript file needs to be listed by name in the extension's Info.plist, in the value of the NSExtensionJavaScriptPreprocessingFile key. The file named there needs to exist in the app extension's bundle. But bundles are not writeable, so you can't replace or change the file.
You might be able to do something like you describe if you:
JavaScriptCore.framework to further process that data in your extension.I don't know of any reason why that wouldn't work, but I haven't tried it, and it's kind of unusual. Still, given your needs, it's worth investigating.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With