How do I build an iOS application?
This lesson will show you how to use LiveCode to create, test and deploy an iPhone or iPad application.
Before you can build iOS applications, you'll need to have Xcode installed on your machine. This is currently available 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 iOS Developer.
Create or open the App you want to build for iOS
If you are creating an App from scratch, you can choose one of the premade stack sizes in the File Menu to suit your iPhone or iPad screen. You can also easily resize your stack to fit whatever device you are creating your project for.
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). Your standalone settings may look like the first screenshot in older versions, or the second if you are using a recent version of LiveCode.
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 more easily than using a real device. Once you have selected the build for iOS option in the standalone builder and selected a simulator from the development menu,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"
An example video of this process can be found here-
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.
Note: Your Internal App ID, set in the standalone builder, is what iOS uses to identify the app. If there is an app on the device with the same identifier as the app you are adding it will assume it is an update and overwrite the app on the device. To avoid this you need to make this ID different for each of your apps.
For more information on registering as an iPhone developer see the lesson here: How Do I Become An iPhone Developer.
Note: if you receive 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 available 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) "Devices"
4) Select your connected iOS device
5) Drag standalone app to "Installed Apps" section of device window
Your app should now be on your device!