Using PyObjC, you can use Python to write Cocoa applications for OS X. Can I write native iPhone apps using Python and if so, how?
-
38iPhone devs are flagging this question as being out of date (too localized), and attempts to resolve this are also drawing complaints that it is still correct. So, if you're here as a result of a search, be warned this answer is from '08 and may not have a correct answer. – Sep 23 '10 at 10:20
-
1To further explain: Apple once had a section in their agreement that specifically listed the allowable programming languages C, C++, Objective-C and Javascript. This was cause for a lot of confusion, doubts and fear. Eventually Apple stopped naming the languages. I know for a fact that even while this was in place, a variety of apps were on the store, being published, or in development that used Lua scripting in some way or another. – CodeSmile Jan 11 '12 at 10:39
14 Answers
You can use PyObjC on the iPhone as well, due to the excellent work by Jay Freeman (saurik). See iPhone Applications in Python.
Note that this requires a jailbroken iPhone at the moment.

- 1,641
- 1
- 15
- 14
Not currently, currently the only languages available to access the iPhone SDK are C/C++, Objective C and Swift.
There is no technical reason why this could not change in the future but I wouldn't hold your breath for this happening in the short term.
That said, Objective-C and Swift really are not too scary...
2016 edit
Javascript with NativeScript framework is available to use now.

- 4,052
- 2
- 30
- 49

- 6,140
- 5
- 34
- 30
-
32I've written a multi-feature iPhone app in Objective-C and a multi-feature Mac app in PyObjC, and I have to say that, based on the experience, Objective-C's syntax for data structures in particular (such as arrays and dictionaries) is significantly more cumbersome and tedious than Python's. I've basically refused to do further development on my iPhone app until Apple includes support for PyObjC. The comparatively verbose and tedious syntax of Objective-C is incredibly distracting to me when I'm trying to develop the top-down flow of my algorithms. – Chris Redford May 19 '10 at 17:45
-
1
-
5@bukzor nope, see http://stackoverflow.com/questions/3691655/embedding-python-in-an-iphone-app – cobbal Sep 22 '10 at 16:29
-
2@cobbal: Then this thread is pretty misleading.. What's the correct way to go about getting it corrected? – bukzor Sep 22 '10 at 17:26
-
@bukzor upvote the now correct answer and leave a comment indicating that the post is out of date (done) – cobbal Sep 22 '10 at 17:42
-
1@Chris Redford you just don't know how to use Objective C effectively my friend =) – Max May 26 '11 at 19:44
-
5@Max Have you used PyObjC to create a Mac application and therefore compared the readability between Apple programs written in Python to Apple programs written in Objective-C? If not, you don't have a basis for that judgement. – Chris Redford Jun 04 '11 at 21:10
It seems this is now something developers are allowed to do: the iOS Developer Agreement was changed yesterday and appears to have been ammended in a such a way as to make embedding a Python interpretter in your application legal:
SECTION 3.3.2 — INTERPRETERS
Old:
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. Unless otherwise approved by Apple in writing, 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). Notwithstanding the foregoing, with Apple’s prior written consent, an Application may use embedded interpreted code in a limited way if such use is solely for providing minor features or functionality that are consistent with the intended and advertised purpose of the Application.
New:
3.3.2 An Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded. The only exception to the foregoing is scripts and code downloaded and run by Apple’s built-in WebKit framework.

- 78,960
- 28
- 103
- 104
Yes you can. You write your code in tinypy (which is restricted Python), then use tinypy to convert it to C++, and finally compile this with XCode into a native iPhone app. Phil Hassey has published a game called Elephants! using this approach. Here are more details,
http://www.philhassey.com/blog/2009/12/23/elephants-is-free-on-the-app-store/

- 884
- 9
- 8
Yes, nowadays you can develop apps for iOS in Python.
There are two frameworks that you may want to checkout: Kivy and PyMob.
Please consider the answers to this question too, as they are more up-to-date than this one.

- 1
- 1

- 5,415
- 6
- 32
- 47
-
-
Depends on your definition of "native". The question implies a definition that covers writing python application for OSX, to a certain extent in the same way that you can now write them for iOS. – Filipe Correia Nov 02 '15 at 18:47
An update to the iOS Developer Agreement means that you can use whatever you like, as long as you meet the developer guidelines. Section 3.3.1, which restricted what developers could use for iOS development, has been entirely removed.
Source: http://daringfireball.net/2010/09/app_store_guidelines

- 609
- 5
- 12
Pythonista has an Export to Xcode feature that allows you to export your Python scripts as Xcode projects that build standalone iOS apps.
https://github.com/ColdGrub1384/Pyto is also worth looking into.

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

- 11,962
- 14
- 43
- 54
2019 Update:
While Python-iOS development is relatively immature and likely will prevent (afaik) your app from having native UI and functionality that could be achieved in an Apple-supported development language, Apple now seems to allow embedding Python interpreters in Native Swift/Obj-C apps.
This supports importing Python libraries and running Python scripts (even with supplied command-line arguments) directly from your Native Swift/Obj-C code.
My company is actually wrapping our infrastructure (originally written in Python) in a native iOS application! It works very well and communication between the parts can be easily achieved via a client-server model.
Here is a nice library by Beeware with a cookiecutter template if you want to try and run Python scripts in your iOS app: https://github.com/beeware/Python-Apple-support/tree/3.6.

- 353
- 1
- 11
Technically, as long as the interpreted code ISN'T downloaded (excluding JavaScript), the app may be approved. Rhomobiles "Rhodes" framework does just that, bundling mobile Ruby, a lightweight version of Rails, and your app for distribution via the app-store. Because both the interpreter and the interpreted code are packaged into the final application - Apple doesn't find it objectionable.
http://rhomobile.com/products/rhodes/
Even after the latest apple press release - rhodes apps (mobile ruby) are still viable on the app-store. I'd find it hard to believe that tinyPy or pyObjC wouldn't find a place if there is a willing developer community.

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

- 26,504
- 11
- 85
- 105
I think it was not possible earlier but I recently heard about PyMob, which seems interesting because the apps are written in Python and the final outputs are native source codes in various platforms (Obj-C for iOS, Java for Android etc). This is certainly quite unique. This webpage explains it in more detail.
I haven't given it a shot yet, but will take a look soon.

- 5,237
- 7
- 41
- 78

- 7
- 1
-
Apparently this is going to be launched as a commercial project. As of now (28-Sep-12) the site says: "We are accepting customers for a limited Beta program. Please contact us to inquire" and that is it. – ccpizza Sep 28 '12 at 12:12
The only significant "external" language for iPhone development that I'm aware of with semi-significant support in terms of frameworks and compatibility is MonoTouch, a C#/.NET environment for developing on the iPhone.

- 23,892
- 18
- 70
- 90
-
Yes but with the new iPhone Developer Agreement we must wait and see what will become of Mono Touch. – TalkingCode Apr 14 '10 at 12:23
-
1