Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppStore / iOS apps and interpreted code - where do they draw the line?

Tags:

Apple's iOS developer guidelines state:

3.3.2 — An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded or used in an Application except for code that is interpreted and run by Apple’s Documented APIs and built-in interpreter(s).

Assuming that downloading data - like XML and images, or a game level description, for example - at run-time is allowed (as is my impression?), I am wondering where they draw the line between "data" and "code". Picture the scenario of an app that delivers interactive "presentations" to users (like a survey, for instance). Presentations are added continuously to the server and different presentations are made available to different users, so they cannot be part of the initial app download (which would be the whole point). They are described in XML format, but being interactive, they might contain conditional branching of this sort (shown in pseudo form to exemplify):

<options id="Gender">
    <option value="1">Male</option>
    <option value="2">Female</option>
</options>

<branches id="Gender">
    <branch value="1">
        <image src="Man" /> 
    </branch>
    <branch value="2">
        <image src="Woman" /> 
    </branch>
</branches>

When this XML is interpreted and "played" within the app, the above would be presented in two steps. First a selection screen is shown, where the user can click on either of the two choices ("Male" or "Female"). Next, an image will be [downloaded dynamically] and displayed based on the choice made in the previous step.

Now, from this, it's easy to imagine additional tags, describing further logic still. For example, a containing tag could be added:

<loop count="3">

    <options... />
    <branches... />

</loop>

The result here being that the selection screen / image screen pair would be sequentially presented three times over, of course.

Or imagine some format describing a level in a game. It is perhaps natural to view that as passive "data", but if it includes, say, several doorways that the user can go through and with various triggers, traps and points attached to them etc - isn't that the same as using a script (or, indeed, interpreted code) - to describe execution sequences, options and their conditional responses?

Assuming that the interpretation engine for the data is already present in the app and that such "presentations" can only be consumed (not created or edited) in the app, how would this fare against Apple's iOS guidelines? Doesn't XML basically constitute a scripting language in this sense (couldn't any program in an interpreted language be described in XML)?

Would it be OK if the proprietary scripting language (ref the XML used above) was strictly sandboxed (how can they tell?) and not given access to the operating system in any way (but able to download content - like a survey or a game level - dynamically as well as upload results - answers or scores - to the authoring server)?

Where does the line go?

like image 429
d7samurai Avatar asked Oct 19 '12 10:10

d7samurai


1 Answers

Update as of WWDC 2017

Programming tools such as Codea mentioned below are now explicitly allowed to download code. The App Store Guidelines currently say (emphasis mine):

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, including other apps. Apps designed to teach, develop, or 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.

There is also this tweet citing more details on the relaxed clauses.

Original

Does your interpreted download allow the user to write infinite loops or recursion?

Apple allow Javascript because they provide the interpreter and can kill your code. I have a feeling I've read that it's a 10 second limit but I couldn't find it on the site with a few minutes searching. (Yes, my self-imposed timeout for writing an answer kicked in.)

I think you're pretty safe if what you do is declarative and doesn't allow obvious looping in the interpreter.

I would also avoid the use of the word "interpreter" in any descriptions visible to Apple including public discussion. Maybe "parser" would be safer.

Codea have skated along the edge of these definitions with their Lua environment and cannot download code. They had to remove a feature for downloading new packages as ".codea" files.

like image 71
Andy Dent Avatar answered Nov 30 '22 06:11

Andy Dent