iphone python or perl processor, or similar - iphone

I have an application to develop but the problem is that is must download part of behavior as a list of instructions from a server.
Ideally it will download scripting code and execute it. The question is if there are any libraries to make it? For example, I have python script and I want to to execute it on device...
Any options?
thank you

Lua is very popular for games. You can embed Python, too. Apple won't enforce the "Objective-C only" clause unless you make it obvious that you use Python to script behavior. Do you think all the games on the store are scripted in Objective-C? No way. Just don't make your transgressions obvious and you'll be fine.

For security reasons, the app store does not allow apps containing programming languages capable of executing arbitrary code on the phone, so your app's market would be limited to users willing to jailbreak their phones to circumvent this restriction.
You could, depending on what you want to do, look at using the browser's JavaScript.

Related

iPhone Download levels for application

I am developing a 2d game for iPhone/iPad. Game will use lua for npc/location scripting and build-in lua interpreter.
I want to allow users to download new levels from our site. Level bundle will contain images, music and lua script that describe npc/location.
I know that Apple doesn't allow to download scripts from application. Maybe exist some workaround to do this? Script must have some limitations? Another script language? Lua byte-code?
Thank for answers.
Apple changed the developer agreement a while back to allow for limited interpreted code to be downloaded to apps and run: http://touchreviews.net/apple-lua-iphone-developer-agreement/
I've heard from more than one person that there are many games already in the App Store that are using Lua in the capacity you're indicating with no issues.
If you fetch the scripts as a part of a large file then how would Apple know? Also if your script is only used internally in your program then I can't see why that should be a problem. One of my appstore programs uses an internal script interpreter and I've never received any comments or warnings from Apple.
You might run into problems if you start compiling the scripts or try to access the iOS API through scripts but I doubt that is something you are doing.

Internal scripting/programming language allowed in an iPhone App Store app?

I've heard some conflicting things about the acceptability of scripting languages (e.g., Lua) in apps for the App Store. I'd like to hear from anyone who understands the policy regarding apps which contain some level of programmability, or someone who has had experience submitting such an app for approval.
For instance, suppose I want to develop a statistical package of some sort. It might provide the user with an application-specific language to code scripts that would manipulate data by calling built-in statistical functions.
If this scripting facility has no access to any entities outside of the application's sandbox, is it likely to present a hurdle to App Store acceptance?
Yes.
Using Javascript code run inside a UIWebView is an explicitly allowed scripting methodology. See PhoneGap for one example usage.
Other scripting languages may be acceptable if they do not run any downloaded code or compile any executable code (even JIT). This is standard methodology for many 3D game engines. (Apple's SDK agreement was changed to allow this circa September 2010.)
Added comments:
Other examples: There are at least 5 Basic interpreters and several programmable calculators currently in the iOS App Store. Perhaps interpreters for Scheme, Ruby and Python as well.
Unknown: If you were to develop an interpreter in Javascript for a statistical language, could that Javascript in a UIWebView download and interpret source code in that application specific statistical language?
If this scripting facility has no access to any entities outside of the application's sandbox [. . .]
Yes, that should be fine. The latest App Store guidelines explicitly permit interpreted code provided that it is not updated remotely.

Common scripting language that can be used on Android and iPhone

I've got an iphone app and I'm looking to port some of the data-layer objective-c code to a scripting language which can also run on an android phone.
Any suggestions on what to use? I'd also like to be able to push new scripts to the app for bug fixes. Not sure if this is against the iphone SDK agreement or not.
JavaScript. Anything else is explicitly banned by the Apple Store Vetting process.
(You could actually serialize some Objective C objects and take advantage of some of the dynamism in the language, but that won't get you far with Android. So, JavaScript.)
As far as I know, iPhone SDK agreement forbids using any scripting languages in your apps.
On the other hand, JavaScript runs both on Android and iPhone (and a couple of other platforms) and is a very powerful language.
The only scripting language that Apple allows for use with downloaded scripts is Javascript.
You can execute the Javascript code inside a visible or invisible UIWebView.
If you write a domain specific language in XML and parse it that way, you could do what you want.
Both platforms can easily parse XML.

New iPhone Dev policy...how does Apple enforce this?

Apple doesn't want anyone to create iPhone apps outside of the Xcode/Objective-C environment. How can they actually enforce this?
If the non Xcode IDE, for example Unity, compiles to an iPhone executable, how will Apple know which dev environment you used to create the app? Can they have Xcode compile some sort of signature into the executable that no one knows about?
For tools such as unity, corona, flash, and other platforms used to 'generate' iphone apps, Apple may be able to 'decompile' and examine your app (look at patterns of generated functions, etc). From this, they might be able to guess that your app was generated with such a tool.
In the limit, this is impossible. Consider the following: I write some script code to generate a bunch of objective-c code. Then I manually import the objective-c files into xcode and build the app. How would apple be able to distinguish the script-generated code from human-written code? Maybe I just tend to write code that happens to look machine-generated. There's no way for apple to determine whether the code was "originally written in objective-c, c, c++ or javascript" or not, yet this would still, technically, violate the agreement. That's why the 3.3.1 part of the agreement is nonsense.
Most automated systems do things a particular way, which isn't hard to detect. If you've ever looked at the PHP or JavaScript code Adobe Dreamweaver generates, for example, you know how easy it is to find stuff like this.
Apple is doing this to prevent people from using Adobe's Flash development framework. It should also be noted that Apple's decision to limit Application Frameworks like this is causing the DOJ/FTC or some government agency to start an informal inquiry into monopolistic practices.
From this article:
"According to the Post's Hollywood source, Apple's ban of Adobe's Flash technology on the iPhone and iPad is what prompted the government to poke around. "
They really don't have an issue up until now with other frameworks because Adobe didn't have one based with the Flash environment. Now that there is one, Apple is going to restrict anything that talks/looks/smells/acts like an Adobe Flash app on the iPhone. In my opinion, they won't do anything to other frameworks, but they'll enforce the rule just for Adobe. Which brings up the whole monopolistic practices thing.
I believe that many of these translator tools have some kind of common runtime function library which take care of the portions that could not be translated 1:1. Those function could then be pretty constant regardless of your application. That way there would be no real need to decompile the app. but instead just look for usage of those function signatures.
FWIW I find the whole idea of limiting user's choice of tools is a bad move.

Is there any sort of programming environment that runs ON an IPhone?

I'm just recalling the days when Radio Shack used to sell pocket computers. (Many moons ago, w/ only a few K of memory.) They had the ability to write small programs on Pocket computer. Maybe it's just nostalgic, but I alway thought that was handy. (Through the fog of my memory.) Is there any capability like that for an Iphone?
Edit:
I can kinda understand not allowing a like a GameBoy emulator on the App-store, it's kinda like saying your ok with people loading "ROMs" and could get them in trouble. When you start profitting from an Emulator the license holders get pissy, just think about "Bleem" and Sony. Sony buried those guys. I suppose Javascript is better than nothing. What about Java in a sandbox? Or if they want something they aren't afraid is going to cannibalise there market, a BASIC interpreter.
I don't believe that you are allowed to in the terms of service for the App store. Isn't this why mono programs have to be staticly compiled if they are going up to the App store.
If you are looking to go off the beaten path, James Long's blog details how to run Gambit Scheme code on the iPhone. Load the application once and then load code changes progressively as needed.
In a following blog post, he details how to debug your applications remotely with an REPL. Very cool stuff. Between the simplicity of Scheme and the existing work he's done on his blog, a lot of the work/difficulty involved with developing in a "non-standard" way on the iPhone is taken care of for you. It's worth a shot!
Python is possible:
http://mail.python.org/pipermail/python-list/2008-November/686098.html
The only thing remotely close to that (without Jailbreaking) is Javascript/HTML in Mobile Safari.
While "on" your iphone is relative www.tilestack.com is a web based development environment that can produce webapps.
Terminal.app can be compiled for limited distribution (w/o jailbreaking). /bin/sh is a valid programming language. QED.
Yes, it is possible to set up a node.js programming environment that lets you run your own server on the iPad. It's also possible to run javascript using the textastic code editor. See Is it possible to do programming using iPhone?.