Can Pythonista projects with GUI be made into an executable file and run on iPhone? - iphone

I have been writing little calculator programs on my iPhone that do arcane calculations, used by machinists to make fancy metal parts. I have been making GUIs, and writing the code in Pythonista on my iPhone, but I can't figure out how to make the app into .exe code. I would like to do this, to make it easy for people in the machine shop to use the code, without accidentally messing it up. Does pyinstaller work with Pythonista? Would I compile on a desktop, and then somehow move the code to the iPhone? How would I move it to the iPhone as an executable? Apple makes things so hard!

You need to use Xcode and the Xcode template. See Xcode Template for Pythonista on Github, by the author of Pythonista.
The template will allow compiling your Pythonista app for iOS, and Xcode can load it onto your device for testing. At that point, the submission process is the same as for any app.

Related

Jailbroken iPhone dev

I have had great success with running perl on my jailbroken iPhone 4: http://coredev.nl/
Now I would like to play with more functionality like CoreLocation. I'd like to query some GPS and orientation data. I do have OSX running in a VM and so I am able to compile iOS apps in Xcode. However I've been having a difficult time learning the ins and outs so far, and I would really like to have some way of hacking together something more UNIX-y that I'm comfortable with, like the server/client networking perl scripts I have been writing.
For example I can easily download some sample code from Apple, load it up in Xcode, compile after switching off the code signing and whatnot, then SCP the app directory into /Applications, restart springboard, and bam it's on the homescreen, I was really happy to have all of this working (through a virtual machine no less!), but this is actually overkill.
What if I want an executable that I can run from perl, which simply spits some GPS coordinates out on stdout? I understand I'll need to use CoreLocation API, but I shouldn't have to deal with MVC, right?
What about the p5-GPS* packages?
http://coredev.nl/cydia/dists/iphone/main/binary-iphoneos-arm/

Quickly testing iOS and objective-c code

I was wondering if is there any way to quickly check iOS/objective-c snippets or new code inside my xcode project without having to compile the whole app for that, open up the simulator just to get the NSLog message traced on the console.
I remember when life was easier using ruby's irb or node command for node.js :)
It just gives me the impression that on iOS development you have to learn how to deal with this high complexity and dependencies all the time, but I am just starting on this new world. so any help would be appreciated.
thanks a lot
This timely blog post should help; I'm using it often already.
Update: there is also Code Runner available in Mac App Store - this supports many languages, including Objective-C.
An Xcode project can contain multiple targets. One of the targets can be a test driver in which you can put some class/object/snippet exercise code and drive it from the command-line, results to the debug console. Another option is to create unit test targets.
If the code you're writing has known expected input-output pairs and you're just writing code to make them work, you may want to look into using XCode's unit testing capabilities. A link to a tutorial on using unit tests is at http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/UnitTesting/0-Introduction/introduction.html . If you want to test more interactive things, it is possible to use Instruments (a program in XCode) to automate those tests as well using the Automation instrument. A guide on using Instruments is available at http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/AboutTracing/AboutTracing.html .
Not really—Objective-C is a compiled language, while I believe Ruby is interpreted (which allows for interactive testing like what you describe). You can reduce some of the overhead of building and running your project by just leaving the simulator open; stopping the app from Xcode will close the app but leave the simulator running, meaning that a rebuilt version of the app will launch more quickly when you run it.

Running python/ruby script on iPhone?

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.
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.
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.
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

Equivalent to a Flash projector for iPhone?

Is there any equivalent to a Flash projector for iPhone? Flash projectors basically seem to package script and Flash libraries into one executable file that can be run on a PC. I'm wondering if anyone has made a similar thing for iPhone where I can take my existing code and package it with the necessary iPhone stuff to make a PC executable. Of course hardware-specific things would not be available like accelerometer/phone/gps, etc. but I don't need any of those. If not, is there anyone currently attempting this?
Thanks for the input guys, but I think everyone except Noah is misinterpreting my question. Flash was just an example, if you hate Flash just pretend I said something else. I am wondering if it is possible to make code for iPhone run on a PC in a similar way to the way a projector works for Flash.
Right now, the only way to run an iPhone app outside of an iDevice is to compile it from source for a non-iPhone target, so it depends on what you're using to compile. If you're authoring in XCode, you can target the Simulator (which is mac-only), but Apple doesn't currently have a way to compile for any other targets, or a way to compile an object file that runs on Macs without the simulator. If you're authoring in Flash CS5, of course you can just publish a projector.
Not at this time. However, Flash CS5 will create iPhone applications.
Flash is not available on the iPhone.
Furthermore, any company attempting to make a Flash runtime -- which would require doing bytecode interpretation -- would run up against Apple's developer agreement, which specifically forbids that.
I think Adobe is planning for CS5 the export to iPhone app feature. It essentially compiles flash's runtime to Apple's cocoa touch framework and produces a true iPhone app, thus circumventing the bytecode interpretation clause. Time will tell, time will tell...
--- Thanks for the clarification Myz... WTB Noah's reading skills, I thought you had typo'd the PC part due to the outrageousness of your question.
If by PC you mean a windows binary simulator interpreting .ipa files. No, such thing doesn't exist and I don't expect to see it for decades. The platform is much more harder to emulate than the old SNES/N64 and others.

Develop iPhone app without a Mac? [duplicate]

This question already has answers here:
Closed 13 years ago.
Possible Duplicates:
How can I develop for iPhone using a Windows development machine?
I'm looking to build an iPhone app for my wife's phone, but am not interested in buying a Mac as a development platform for a one-off piece of work. The app:
should run standalone on the iPhone (i.e. without network connectivity)
would be perfectly acceptable with a GUI created using one of the iPhone Javascript libraries that are around
will do some database IO to read and update data
has no commercial value and will never be used by anyone else
Here's my thinking:
jailbreak the iPhone
install Ruby + Sinatra on the iPhone
write the app using Sinatra, hitting a database (SQLite?) on the iPhone
To access the app on the iPhone:
start the Sinatra app in the
background (is this possible?)
start a Safari browser session
navigate to the Sinatra app at e.g. http://localhost:12345
etc.
This seems like a strange approach, but I can't think of a simpler way of writing a standalone iPhone app without buying a Mac. Is there a better way of doing this?
The only reliable info I could find is at the always-excellent MetaFilter
http://ask.metafilter.com/110466/Anyway-to-develop-iPhoneiTouch-apps-without-investing-in-a-Mac
The answer is apparently no.
You absolutely need an Intel Mac of some description.
The entire iPhone build process is too deeply ingrained in XCode to build elsewhere; and the only other Objective-C compiler I know is gcc, which doesn't support any Apple's additions to the language (nor their libraries).
And, in direct opposition to what people are saying above, Objective-C is absolutely my favorite native, compiled language. Elegant, small (only a few changes from C), late-binding, dynamic, straightforward. It's what C++ should have been.
Lots of people recommend picking up a secondhand Intel (remember, must be Intel!) Mac Mini as the cheapest "port of entry".
What you have described is a viable solution, however you should consider using the open toolchain for the iphone.
You don't need a mac then, only need to jailbreak the phone to make sure your app will work.
For all those who say it can't be done, this was the only way to make Apps for the iphone before the SDK was out :)
Also if you are after a guide to using the open toolchain then I highly recomend this book
If you're considering creating a GUI using a javascript library anyway, why don't you just write a web app instead of an iPhone-native one? It seems like overkill to jailbreak the device just so that you can install a ruby + sinatra web app on it. Can't you just put the ruby web app on a server and create a Safari shortcut to it on the home screen? If you don't have a server, you could always run the website off a PC in your home...
Jailbreaking the OS and running a ruby app onto it would be technically cool, don't get me wrong - I just think it'd end up being a time sink.
Just my 2c!
Depends on what your time is worth, I guess. That seems like a terribly convoluted way to get what is otherwise a simple app on the phone to avoid the US$400 purchase of a used Mac Mini.
There is the hackintosh route, which may work on your existing hardware, but again one has to put a price on time. It's what got me started before I dropped big coin on a Macbook Pro, an MSI Wind then a home-built. It's of questionable legality (the right thing to do is fork over US$129 for Leopard regardless), but you are already talking about jailbreaking. :-)
Get someone else to do it, or rent the resources that you need.
Another option is to find nearby iPhone developer who has it all setup and either get him to write the app or do it together, he provides development environment you code the solution or code it together.
The only problem is that you wont be able to update maintain it.
I would still consider getting older gen Mac or Mac mini - all the other options sound more complicated.
If you are going to be stubborn about not using a mac, but you want an app that will work offline with the iPhone / iPod Touch and Android devices, then I would use HTML 5 to create an offline app.
You can do a lot now with HTML 5 - Google have an email client that uses HTML 5 for the iPhone now and it can work offline etc. If you do this and get the user to add a bookmark to their home screen for your app - it will be almost as good.
If I was you I'd fork out for a mac - or look to see if you could borrow one - or time-share with someone - you will not create a very good quality app without it.
You can jailbreak the phone and install Python. There are some sample applications in Cydia for it (it's called iPhone/Python. Search for Python in cydia).
Then you will have a "native" app, not a web application and you can use the entire iPhone UI library (the part of it that is accessible via py-objc anyway) and you don't need to run a web server in the background.
You can do your development on the phone itself via SSH or you can use an iPod Touch for it. Packaging is also easy (should you need it), just create your own Cydia repository and host your package(s) in there.
Look at iPhone applications in Python for more information.
Come on, just look on eBay for the cheapest intel mac mini you can find. Even a Mac laptop with a busted screen (that you could hook to an external display) would work. You're talking just a few hundred dollars probably and then you can maintain it as her phone/Touch is upgraded.
there's some special meta tags you can put in a webpage to make your web app savable and full screenable to the iphone hard drive. (so it can work offline) Here's an example : http://mrgan.tumblr.com/post/125490362/glyphboard2
There's also frameworks like phonegap that let you access cocoa apis from javascript, but it sounds like you don't need that.
Does your wife enrolled in any kind of data plan? If so, you can simply write a small webapp which runs on some cheap webspace and access it via MobileSafari.
If you need a full grown iPhone application, you better look after one of the first intel-based mac minis on eBay, should be to expensive, in my opinion. And as a plus you avoid the hassle of a jailbreak.