How do I build an iOS application?
This lesson will show you how to use LiveCode to create, test and deploy an iPhone application.
Before you can build iPhone applications, you'll need to have Xcode installed on your machine. This is currently avaliable from the Mac App Store or you can register as an iPhone developer and get older SDKs here: http://developer.apple.com/iphone. For more information on how to get started with iPhone development see this lesson: How Do I Become An iPhone Developer.
Create or open the App you want to build for iOS
If you are creating an App from scratch, then is is good practie to set your stack size to something that is workable for your display. LiveCodes resolution independece features make it easy to resize any size stack to any screen resolution. More information on this feature is avalible here-
Some example device resolutions that you may wish to set your stack dimesions to are
iPhone 3G and older: 480px by 320px
iPhone 4: 960px by 640px.
iPad: 1024px by 768px
iPad Retina- 2048px by 1536px
For this example we've used the sheep herder application we made to demonstrate LiveCode in action. You can download the source here:
And watch us make it here:
Open the standalone builder and configure deployment options
Open the standalone application setting from the File menu and go to the iOS tab. Here you'll be able to configure the Apps basic settings and also set a wide range of other more fine grained options (Plist options for those more seasoned developers).
You must select "Build for iOS" (1) in order to enable the Simulator and building iOS standalones.
You must also select the device profile(2) you created when you registered with Apple. (if deploying to a test device)
Testing with the simulator
When you install the Xcode on your machine, you'll get an iOS simulator application, which allows you to debug your iOS apps easier than using a real device. Once you have selected the build for iOS option in the standalone builder, you'll see the "Test" button has now become active. Clicking this will launch the simulator*.
NB Xcode must be linked to your version of LiveCode via LiveCodes Mobile Support Preferences. This option is available from "LiveCode"--->"Preferences"---->"Mobile Support"
Creating the deployment bundle
Once you have registered appropriately as an iPhone developer and setup your certificate and obtained a provisioning profile, you can deploy your application onto a real iPhone, iPad or iPod touch. To do this, simply choose your provisioning profile from the drop-down list in the standalone application setting screen(like discussed above), and then select "Save as Standalone Application..." from the file menu.
For more information on registering as an iPhone developer see the lesson here: How Do I Become An iPhone Developer.
N.B. if you recieve a "linking for armv7 failed with g++: failed to exec /Applications/Xcode.app/Contents/Developer/usr/bin/clang++; No such file or directory" error message when building this generally means the required command line tools have not been automatically set in Xcode. You can resolve this by opening Xcodes preferences, navigating to "Locations" and select the avaible command line tools from the drop down menu. If none are present, you may need to download them from the "Downloads" tab
Putting the App onto your device
1) Open Xcode
2) In the 'Window' menu select 3) "Organizer"
4) Drag your App bundle to your connected device
You app should now be on your device!