IOS: Download the script and execute it?

We have an application that basically analyzes some web pages. The fact is that the structure of web pages sometimes changes, so we need to release an update (of course, wait for Apple's approval). We would like to be able to have some kind of "script" logic on our server, which can be sent to the application as needed. JavaScript code is possible, but I don't want to have a UIWebView just for parsing some strings. Is there an alternative?

thanks

+4
source share
3 answers

If you are basically looking for a way to parse strings, one possibility uses regular expressions to do the job, and thus provides a definition for that regular expression in a text or XML file that you can load. This is not a complete scripting solution, for example, the one where you download the code and execute it, but it should work equally well. I believe that this should also be fully consistent with Appleโ€™s terms.

There are several iOS frameworks that offer regex support: RegExKit , AGRegEx , and in iOS 4 you also have NSRegularExpression .

0
source

No. Running executable files or scripts that are not a built-in component of your application is expressly prohibited by the license agreement of the developer program:

3.3.2. An application may not download or install executable code. Interpreted code can only be used in an application if all scripts, code, and interpreters are packaged in the application and not loaded. The only exceptions to the above are scripts and code downloaded and executed by Appleโ€™s embedded WebKit framework.

+4
source

You can embed a scripting language such as lua. See here and here . I don't know too much about this, but it is used in many scripting applications, just like your needs.

I am not 100% sure how to integrate it, or if the scripts can be loaded, but this will probably work.

Note:

I'm not sure that Apple will let you download and run arbitrary scripts, but it's worth it.

0
source

All Articles