[ACCEPTED]-Can I write native iPhone apps using Python?-cocoa-touch

Accepted answer
Score: 53

You can use PyObjC on the iPhone as well, due 3 to the excellent work by Jay Freeman (saurik). See 2 iPhone Applications in Python.

Note that this requires a jailbroken iPhone 1 at the moment.

Score: 38

Not currently, currently the only languages 8 available to access the iPhone SDK are C/C++, Objective 7 C and Swift.

There is no technical reason 6 why this could not change in the future 5 but I wouldn't hold your breath for this 4 happening in the short term.

That said, Objective-C 3 and Swift really are not too scary...

2016 edit

Javascript 2 with NativeScript framework is available 1 to use now.

Score: 24

It seems this is now something developers 28 are allowed to do: the iOS Developer Agreement 27 was changed yesterday and appears to have 26 been ammended in a such a way as to make 25 embedding a Python interpretter in your 24 application legal:



3.3.2 An Application may 23 not itself install or launch other executable code 22 by any means, including without limitation 21 through the use of a plug-in architecture, calling 20 other frameworks, other APIs or otherwise. Unless 19 otherwise approved by Apple in writing, no 18 interpreted code may be downloaded or 17 used in an Application except for code 16 that is interpreted and run by Apple’s 15 Documented APIs and built-in interpreter(s). Notwithstanding 14 the foregoing, with Apple’s prior written 13 consent, an Application may use embedded interpreted 12 code in a limited way if such use is solely 11 for providing minor features or functionality 10 that are consistent with the intended 9 and advertised purpose of the Application.


3.3.2 8 An Application may not download or install 7 executable code. Interpreted code may 6 only be used in an Application if all 5 scripts, code and interpreters are packaged 4 in the Application and not downloaded. The only 3 exception to the foregoing is scripts 2 and code downloaded and run by Apple’s 1 built-in WebKit framework.

Score: 23

Yes you can. You write your code in tinypy 5 (which is restricted Python), then use tinypy 4 to convert it to C++, and finally compile 3 this with XCode into a native iPhone app. Phil 2 Hassey has published a game called Elephants! using 1 this approach. Here are more details,


Score: 21

Yes, nowadays you can develop apps for iOS 4 in Python.

There are two frameworks that 3 you may want to checkout: Kivy and PyMob.

Please consider 2 the answers to this question too, as they are more up-to-date 1 than this one.

Score: 19

An update to the iOS Developer Agreement 5 means that you can use whatever you like, as 4 long as you meet the developer guidelines. Section 3 3.3.1, which restricted what developers 2 could use for iOS development, has been 1 entirely removed.

Source: http://daringfireball.net/2010/09/app_store_guidelines

Score: 10

Pythonista has an Export to Xcode feature that allows 3 you to export your Python scripts as Xcode 2 projects that build standalone iOS apps.

https://github.com/ColdGrub1384/Pyto is 1 also worth looking into.

Score: 4

The iPhone SDK agreement is also rather 7 vague about whether you're even allowed 6 to run scripting languages (outside of a 5 WebView's Javascript). My reading is that 4 it is OK - as long as none of the scripts 3 you execute are downloaded from the network 2 (so pre-installed and user-edited scripts 1 seem to be OK).

IANAL etc etc.

Score: 3

BeeWare is an open source framework for authoring 1 native iOS & Android apps.

Score: 3

2019 Update:

While Python-iOS development is relatively 17 immature and likely will prevent (afaik) your 16 app from having native UI and functionality 15 that could be achieved in an Apple-supported 14 development language, Apple now seems to 13 allow embedding Python interpreters in Native 12 Swift/Obj-C apps.

This supports importing 11 Python libraries and running Python scripts 10 (even with supplied command-line arguments) directly 9 from your Native Swift/Obj-C code.

My company 8 is actually wrapping our infrastructure 7 (originally written in Python) in a native 6 iOS application! It works very well and 5 communication between the parts can be easily 4 achieved via a client-server model.

Here 3 is a nice library by Beeware with a cookiecutter 2 template if you want to try and run Python 1 scripts in your iOS app: https://github.com/beeware/Python-Apple-support/tree/3.6.

Score: 1

Technically, as long as the interpreted 13 code ISN'T downloaded (excluding JavaScript), the 12 app may be approved. Rhomobiles "Rhodes" framework 11 does just that, bundling mobile Ruby, a 10 lightweight version of Rails, and your app 9 for distribution via the app-store. Because 8 both the interpreter and the interpreted 7 code are packaged into the final application 6 - Apple doesn't find it objectionable.


Even 5 after the latest apple press release - rhodes 4 apps (mobile ruby) are still viable on the 3 app-store. I'd find it hard to believe that 2 tinyPy or pyObjC wouldn't find a place if 1 there is a willing developer community.

Score: 0

You can do this with PyObjC, with a jailbroken 7 phone of course. But if you want to get 6 it into the App Store, they will not allow 5 it because it "interprets code." However, you 4 may be able to use Shed Skin, although I'm not aware 3 of anyone doing this. I can't think of any 2 good reason to do this though, as you lose 1 dynamic typing, and might as well use ObjC.

More Related questions