6

From the recent news from the Apple, I learned that one has to use C/C++/Objective-C for iPhone App. Accordingly, it's not possible to use MacPython or similar to make iPhone App.

But as the python/ruby interpreter itself is written in C, isn't it OK to make python/ruby interpreter for iPhone to run the scripts on iphone?

Is this possible? Does Apple support this? Or does someone implemented this? Or, the user should hack to do this?

Added

I don't distribute the python script, I just use it for my own utility. Even in this case, do I need a jailbreak? I mean, can I compile the python with Xcode to get the binary? Or, I expect someone has already done this.

mt3
  • 2,654
  • 4
  • 26
  • 29
prosseek
  • 182,215
  • 215
  • 566
  • 871
  • Remember, the restrictions are only for OS 4. On OS 3 you can use any framework. – Armstrongest Apr 21 '10 at 14:10
  • 2
    From the iPhone OS 4 Terms --- 3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and **must not use or call any private APIs**. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an **intermediary translation or compatibility layer or tool are prohibited**). – Nick T Apr 21 '10 at 14:20

3 Answers3

7

Apple recently changed their policy on this and allowed a python interpreter App called Python for iOS to be put up on the App store:

http://itunes.apple.com/us/app/python-for-ios/id485729872?mt=8&uo=4


Full disclosure: I am the sole creator/developer of Python for iOS.

chown
  • 51,908
  • 16
  • 134
  • 170
  • Looks good! Can external calls be made to this app from other apps in any way? – mt3 Oct 16 '12 at 08:19
  • @mt3 Unfortunately, no, not on non-jailbroken devices. All non-Apple Apps are restricted to their own scope. Only native Apps like Mail/Safari/Settings/etc can interact with other Apps. – chown Oct 16 '12 at 22:10
  • I have a script that makes a http request and saves a small file. Is it possible to port that to your iOS app? Thanks. – Tagar Mar 02 '17 at 04:22
2

At present not at all. Apple licenses forbid to run any intepreter on it, and this is even before iPhone OS 4. You can make an intepreter by jailbreaking it but it won't be official and you won't be able to distribute it.

Xolve
  • 22,298
  • 21
  • 77
  • 125
1

I don't distribute the python script, I just use it for my own utility. Even in this case, do I need a jailbreak?

No, you don't. You can compile a Python interpreter and run it on your own iPhone, as long as you have a developer license.

Maybe you can use ad-hoc distribution (according to Apple, you can distribute your app to 100 devices by yourself, outside of the app store) ? See here

Krumelur
  • 31,081
  • 7
  • 77
  • 119
  • I'm the author of an iPad app that uses embedded Python to execute internal scripts. I have a version of my app that I use for development, and release via ad-hoc to others in development mode, that allows me to add scripts to it without recompiling through the iTunes interface. The theory is, when I have a final set of scripts that work in the app, I bundle them into the app, and #ifdef out the iTunes integration code, with a final Xcode compile and release the app. Thus: quick development of scripts without recompile, and compliance with the App Store restrictions upon release. Useful? – Dave Sep 22 '12 at 21:57