A Mercurial repository is at Assembla at . A Git repository is at GitHub at git:///ewmailing/XcodeScriptingBridge.git. So you can play with this, I am providing a trivial Xcode example project and simplified Xcode Scripting Bridge script to control it. Local av_player = AVPlayer:playerWithURL_(file_url)īasically, bracket notation turns into a function call, colons are changed to underscores, and named parameters are flattened into a single function name. Local file_url = NSURL:fileURLWithPath_isDirectory_("/tmp/SomeFile.mp4", false) The final trick is to know how one language maps to the other.Īs a simple trivial example, In Objective-C, you might do: So don't be deterred or intimidated by the Lua code presented here. It is so easy to learn, that the majority of the video game industry uses Lua (from Monkey Island, to World of Warcraft, to Angry Birds) because their artists and content creators can learn it very quickly, be productive in it, and crank out levels, characters, items, etc. Since the Corona programming language is Lua, and I am also the author of LuaCocoa (a bridge like PyObjC/Rub圜ocoa for Lua), it made a lot of sense for us to write our Scripting Bridge/Xcode script in Lua via LuaCocoa.įor those not familiar with Lua, it is a very easy language to learn. (You also have to generate header files and refer to them in your compile process.) The whole compile/link/launch/debug/repeat cycle can be slow for this, so interpreted languages have an advantage here. So the first thing to do is pick a language.įor this kind of work, Obj-C is a not so great language because there is almost no documentation for Xcode's scripting dictionary so you need to experiment by calling methods and seeing what you get back. But any language that has been bridged to Objective-C can be used. Officially, Apple supports Objective-C, Python (via PyObjC), and Ruby (via Rub圜ocoa or MacRuby) as alternative Scripting Bridge languages. Certainly for me, I find Applescript to be a language that is easy to read, but impossible to write. Scripting Bridge and LuaCocoa in nutshellįor those who are not familiar with Scripting Bridge, it is a technology launched in Mac OS X 10.5 Leopard that allowed other dynamic languages beside Applescript to talk to an application's scripting dictionary which allows you to programmatically control an application. ![]() My hope is that by sharing this information, enough demand might be created to get Apple to prioritize this kind of support, or somebody clever might figure out a different solution. I will share what I know about trying to get this to work in Xcode 4. So everything I present here only works in Xcode 3. Little did I know that Xcode 4 would completely break and cripple their scripting support. So Scripting Bridge became the solution I pursued.Īt the time, Xcode 3 was the current stable release and it was not known when Xcode 4 would ship. I found that Xcode alone seemed to have APIs that could build, install, and launch an application. Both iTunes and Xcode Organizer have drag-and-drop ways of installing an application, but drag-and-drop is not Applescriptable according to my talks with engineers at WWDC.ĭigging around the Scripting Bridge dictionaries of the above apps. ![]() I saw nothing useful in iPhone Configuration Utility. I looked at iTunes, Xcode Organizer (3.x, 4.0) and the iPhone Configuration Utility. Those who are wondering, the command line tool xcodebuild will not install to a device, and instruments (for UIAutomation) will not install an application to a device either. I would love to be corrected (please tell me!), but otherwise, there are no command line tools Apple provides to help with this. We don't want to jailbreak our devices because that can cause other problems (like breaking push notifications and in-app purchases). The fundamental problem is that there are no good automated ways to install and launch an app to an iOS device. Now that you've seen the overview of the whole system, I'm going to talk about on-device testing on iOS first because this has been where we have endured the most pain. ![]() This post is a mirror of what I posted on.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |