Beyond any TOS issues there has always been a technical issue where an app store app cannot write to memory that is marked executable for security purposes.
This prevents JIT's but does not prevent an interpreter from functioning since an interpreter does not directly generate machine code and execute it, it simply reads the code to interpret as data and executes through its own engine.
Most modern JS engines JIT which is why you don't see say electron / node / chromium based stuff on iOS, a lot of it has to do with V8 requiring the ability to JIT.
Hermes does not JIT so it sidesteps the technical limitations on iOS then its just a matter of passing review.
There where some ways around this that have been patched and Apple has recent introduced an official entitlement but does not allow it in the app store yet:
Unfortunate but I was surprised Apple looked like they where changing it at all since it would lessen security allowing some common attack vectors.
I haven't followed it for some time however, it does look like V8 supports a JITless mode now which allows it to possibly be used on iOS and other platforms with NX set, albeit with significant performance loss:
Looks like JavaScriptCore still disables JIT when run in a non entitled app. Always thought they might figure out a way to at least let their own JS engine JIT since its trusted in Safari on the open web, but I believe its an all or nothing thing for the process/app and not per module thing.
JavaScriptCore could use a daemon process with elevated privileges that does the JIT-ting and then shares back the executable memory pages with the sandboxed process. It's simply a matter of Apple wanting to curb React Native because it threatens their control over app development.
Out of process mean a loss in performance itself due to marshaling cross process calls and data. When your dealing with UI orchestration its probably better / faster to run an interpreter with no cross process overhead than a JIT with the overhead. Think Web Workers which have similar issues, you have to keep your communication with worker chunky for good performance.
You're misunderstanding what I've described. Only the JITting would occur in a separate process. The sandboxed app would give the JS code to the JITter daemon, then the JITted code would be mapped to the address space of the sandboxed app, where it would run just as if it was part of the native app binary. There's no marshalling other than sending JS code to the JIT daemon.
Yes I did misunderstand and that may work to get around the NX restriction being per process it would probably be a significant change to the JIT architecture in order for it to work out of process. This also would probably have security implications since it looks like old MS Edge did this for mitigation and Google found possible exploits: https://googleprojectzero.blogspot.com/2018/05/bypassing-mit...
Yep, that's pretty much what I've described, and it is the reason why I'm certain that there's no technical limitation at play here. Apple just chose to not allow this for political/strategic reasons.
Which is fine if you're doing an HTML UI (PhoneGap) since the DOM and JS engine share the same process. If you're doing a native UI with JS then it must marshal cross process to affect the UI then you have to decide which is worse, no JIT or cross process overhead.
Definitely fine for Android (there's plenty of them), but I would've thought the same for iOS.
Now that I think of it though, I think the Apple ToS that prohibit browsers are about function (app used to browse the web) rather than internals (language support in the engine).
I think the issue is if you interpret dynamically fetched code. So you couldn't use this for out-of-band updates to internals (unless you're important enough).
I'm not sure that's true. When you use react native you can update your javascript bundle and push it to an application already deployed to the App Store and that doesn't seem to be an issue. The application can check at startup if a new bundle is available, otherwise defaults to the local bundle.
Apparently Apple is ok with out-of-band updates as long as they don't add or change features. If it's used to fix a bug then it's ok (at least they haven't cracked down on React-native apps using codepush/expo's auto update feature, yet.). There have been reports of Apple's reviewers asking for clarification on why apps have the ability to update, and as long as the answer is "bug fixes" then they approve the app.
Apple's ToS prevent any kind of interpreted language in iOS apps.
> 2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the Application completely viewable and editable by the user.
Basically embedding any interpreted language inside the app is frowned upon by apple. But historically they have allowed JavaScript and Lua scripts to be embedded in apps.
"Such apps must make the source code provided by the Application completely viewable and editable by the user."
arguably the ability to view source was what created the possibilities of the Web, and as such I don't read this term to be restrictive but instead merely trying to get the best outcome for everyone.
disclaimer being that I have spent a large part of the past year evaluating a ios app for commercial release that both relies on decades of proprietary design and which probably doesn't have a significant future unless it is opened extensively or completely.
That does not ban the interpreters. It prevents interpretation of downloaded code. But as long the sources to be interpreted are bundled with app, it is OK at least from that section.
They used to be. I can't remember the exact part now but the TOS used to ban anything that wasn't iOS's own JavaScriptCore runtime. They changed it a few years ago.
I don’t think interpreters were ever banned, if you weren’t executing code downloaded from the internet: at least, there’s always been a variety of lisp/Python/Ruby environments available to play with.