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-

http://lessons.runrev.com/s/lessons/m/15262/l/156477-how-do-i-make-my-app-scale-to-fit-the-screen-on-all-devices

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:

http://revonline2.runrev.com/stack/675/SheepHerder

And watch us make it here:

http://www.youtube.com/watch?v=0dj1_8C8P0o

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.

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!

Comments (30)

Javier Garcia Sunday Jun 05 at 10:15 AM

I am an old-style-dbase-III-style developer and I am testing the free trial live code. I love it. I would like to know if when I finish my project and build the stand-alone-app (and buy the apple developer license and live code license), will I have to learn x-code and modify the app in order to send the app to apple so it can be approved and sold in the app store?

Mark Wieder Sunday Jun 05 at 06:01 PM

No - no xcode and no conversion necessary to get the app into the app store.

Hanson Schmidt-Cornelius Tuesday Jul 26 at 11:46 AM

Hi Javier,

once you have implemented your application and it works on the iOS simulator, you should be able to submit it to the app store. As you point out correctly, you will first have to follow the appropriate certification and approval process. You should not have to write any x-code.

You can check out the following lessons for more information: "How do I Create a Distribution Profile for iOS?", "How do I set up an App for Submission to iTunes Connect?" and "How do I Submit an iOS App to the App Store?".

Steven Whyte Tuesday Nov 01 at 09:31 PM

I can't seem to install more than one application on my phone.

How do I go about adding more applications that I have created in LiveCode to my phone through xCode?

Whenever I try to add a new app, it forces me to overwrite the one I already have on there.

Any ideas?

Kind regards,

Steven

Elanor Buchanan Wednesday Nov 02 at 10:52 AM

Hi Steven

In the iOS Standalone Application Settings you can set the Internal App ID, by default this is com.yourcompany.yourapp.

This 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. You just need to make this ID different for each of your apps.

I hope that helps.

Kind regards

Elanor

Dennis Monday Nov 14 at 03:20 AM

Do I have to join the iOS Developer program (as a paid member) to even get my LiveCode app to run in the iOS Simulator?

Elanor Buchanan Monday Nov 14 at 12:33 PM

Hi Dennis

There is a free Apple Developer Program you can join which allows you to run your apps in the simulator but not deploy them to a real device or put them in the App Store. For this you do need to join the paid for program.

You can register at

http://developer.apple.com/programs/register/

I hope that helps.

Kind regards

Elanor

Herman Schippers Monday Feb 20 at 10:09 AM

Thank you for LiveCode, I really like it.
At the moment I try to submit my App for the App store.

But first I try to save it as a stand alone, and there the problem starts. I have to check the Application Profile, but there is only I can select.
In your example I see under "Open the standalone builder and configure deployment options" you check 'RevMobile iPhone PreAlpha'.
In other words, how can I set the profile proper?

waiting for your help,
kind regards, Herman

Hanson Schmidt-Cornelius Monday Feb 20 at 12:23 PM

Hello Herman,

I am assuming you are trying to select "RevMobile iPhone PreAlpha" from the "Profile" drop down menu.

"RevMobile iPhone PreAlpha" is a provisioning profile we set up to test the application. You have to set up a provisioning profile for application distribution. Once you have done that, you should have a provisioning profile for App Store distribution.

I have included references to the following lessons that should help you further:
http://lessons.runrev.com/s/lessons/m/4069/l/23275-how-do-i-become-an-ios-developer
http://lessons.runrev.com/s/lessons/m/4069/l/32957-how-do-i-create-a-distribution-profile-for-ios
http://lessons.runrev.com/s/lessons/m/4069/l/33065-how-do-i-set-up-an-app-for-submission-to-itunes-connect
http://lessons.runrev.com/s/lessons/m/4069/l/33064-how-do-i-submit-an-ios-app-to-the-app-store

Kind Regards,

Hanson

Herman Schippers Monday Feb 20 at 06:39 PM

Hello Hanson and Karthik

Thank you for your emails.
I try to make an App using LiveCode for the iPhone

I try to create a distribution profile now.
It takes a lot of time. The lessons are very helpful, Hanson, I suppose I have to make an App ID, too?

Herman

Hanson Schmidt-Cornelius Tuesday Feb 21 at 09:53 AM

Hello Herman,

yes should create an App ID early on. You can find more information on the App ID from the Apple iOS Developer Portal.

Yes, there are a number of steps involved in getting your App into the App Store. We do not control the submission process and can only point you at the steps you have to take.

Kind Regards,

Hanson

Ian Stewart Friday Mar 15 at 05:01 PM

Hello

I'm trying to run an iOS app but when I press the 'test' button to run the simulator I get a message saying 'Unable to start simulation: iOS simulator failed to install the application'.

I appear to have the correct SDKs installed (I get the little green box in the 'preferences/mobile support' window).

In 'standalone application settings' I have 'iOS' selected and though I have a number of different profiles I have selected each of them in turn but none seems to work.

Any clues as to what might be going wrong?

Thanks
Ian S

Albert White Sunday Mar 17 at 03:30 PM

When I am at the Standalone App Settings window there is (none) on the Profile setting. I have followed all the directions to set up my developer profile and have obtained the public and private developer keys as well as two provisioning profiles and the iPhone Developer Certificate. Livecode and the apple developer stuff should be paid for. I have tested my application in the iphone simulator and it does work correctly. I have a Mac OS 10.7.4, Livecode 5.5.4, and Xcode versions 4.4 and 4.6.1.
Thank you for your assistance,
Albert

Hanson Schmidt-Cornelius Tuesday Mar 19 at 05:28 PM

Hi Ian,

you could get that error message if you already have a stack with the same name installed on the simulator.
If that is the cause for the problem, then you can either remove the stack from the simulator, change the "Internal App ID" in the Standalone Application Settings, or you can use the reset function in your iOS simulator.

Kind Regards,

Hanson

Hanson Schmidt-Cornelius Tuesday Mar 19 at 05:45 PM

Hi Albert,

it sounds like LiveCode cannot see your Provisioning Profile. It is possible that even though you have one, it may not be installed.

Open Xcode to launch the Organizer "Window->Organizer". A new window opens.
Select the "Devices" icon a the top of the window.
On the left hand side select "Provisioning Profiles" to display what profiles are installed.
If the relevant profile is missing, then select the "Import" button at the bottom of the window and import the profile you are missing.

Kind Regards,

Hanson

albert Chan Saturday Apr 06 at 12:49 PM

I have a Mac OS 10.7.4, Livecode 5.5.4, and Xcode versions 4.4 and 4.6.1.
Is is possible to build for iphone 5 only?
My stack is 1136 x 640 and it deploy ok to the iphone 5

Dexter Francis Thursday Apr 11 at 12:03 PM

I just downloaded the Commercial Edition 6.0.0 Build 1511 and started the How do I build an iPhone application for iOS tutorial and I already have a problem... The tutorial says:

"Open the standalone builder 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."

However, there is no iOS tab in the application settings for the new project I just created. I can see a Test Target item in the Development Pull Down Menu, but the choices there are grayed out. I am already a registered Apple iOS developer and have valid certificates. What am I missing?

Elanor Buchanan Friday Apr 12 at 10:55 AM

Hi Dexter

You can open the Standalone Application Setting from the File menu. In there you can check the option for building for iOS. This should enable the Test option for testing on the simulator.

I hope that helps.

Kind regards

Elanor

Hanson Schmidt-Cornelius Monday Apr 15 at 05:33 PM

Hi Albert,

it is not specifically possible to build for iPhone 5, but you can limit your application to a minimum iOS version.

If you would like your application to work only on iPhone 5, then you could use the iPhoneDeviceResolution function to get the resolution of the device and determine if you would like your application to run on this device. If this function does not return the resolution your application requires, then you could launch a dialog that requests the user to terminate the application.

Kind Regards,

Hanson

Dexter Francis Monday Apr 15 at 06:18 PM

How about the SDK load? I started with a new install of xCode about two months ago and only have the iOS 6 libraries. When I try to build an app I get an error message that I'm missing the files for iOS 5 or that the version of arm processor I'm building for is wrong. Any suggestions?

Hanson Schmidt-Cornelius Tuesday Apr 16 at 01:25 PM

Hi Dexter,

in order to build for older versions of iOS you require older versions of xCode. Have a look at section: "Configuring LiveCode for iOS Support" of lesson: "How do I Become an iOS Developer?" http://lessons.runrev.com/s/lessons/m/4069/l/23275
This shows you how to include a number of version of xCode in LiveCode.
In that example we use xCode 4.4 and 4.5. This supports 5.1 and 6.0. I would try including something like xCode 4.3.1. This should give you support for 5.0.

Kind Regards,

Hanson

Jun Wednesday Jun 05 at 05:03 AM

Hello,

I have tried to create a simple hello world application for iOS. I have a provisioning profile setup but when I try to install the app on my iPad using iTunes, it fails to install.

Any idea?

Thanks,
Jun

Hanson Schmidt-Cornelius Wednesday Jun 05 at 10:27 AM

Hi Jun,

if you want to install an application on your iPad, then you need to subscribe to the iOS Developer Program, I assume you did that, as you have a provisioning profile.

You also need an installation of xCode and it is through xCode that you install the LiveCode application on your device. You can have a look at the following lesson for information on setting yourself up as an iOS developer: http://lessons.runrev.com/s/lessons/m/4069/l/23275

At the end of that lesson there is a further link to a lesson that gives you more information on developing for iOS.

Kind Regards,

Hanson

Jun Wednesday Jun 05 at 10:51 AM

Hi Hanson,

Thank you Hanson. one reason I've experience that problem is that, I think I used the same provisioning profile which is already used by other app? I've used another valid profile which was setup by my colleague before and it works fine.

Another thing is, I've tried to create another development provisioning profile but I got "Valid signing identity not found" on the status when I install it.

Here's what I did:
1. Create another app ID under identifier and select 1 current certificate.
2. Create another development provisioning profile and used the app ID I created earlier
3. Download both the certificate and provisioning profile and install them, got not valid signing identity problem.

Thanks,
Jun

Hanson Schmidt-Cornelius Wednesday Jun 05 at 04:03 PM

Hi Jun,

great, thank you for sharing your experience and solution.

The iOS provisioning process can be challenging and may require more than one attempt to get right.

We provide information in our lessons on provisioning, but this is targeted more at provisioning with regards to the requirements for LiveCode.

Apple provide detailed step by step instructions on provisioning for iOS development in their developers portal.

Kind Regards,

Hanson

Filip Tuesday Jul 02 at 10:50 AM

Hi,

I have tried to download the sheep application in order to work with this tutorial, but it is only zero bytes, ergo: there is nothing to download. I went to the page you guys mention hereabove, and click on the download link. Then I a asked to save the file somewhere (like always when I download something) but when I download it, it is an empty file. I tried to rename it but it didn't help either. Any suggestions? Maybe the download link is 'dead' ?

Best,

Filip

Elanor Buchanan Wednesday Jul 03 at 11:49 AM

Hi Filip

Thanks for letting us know about this, I have updated the link in the lesson to point to

http://revonline2.runrev.com/stack/675/SheepHerder

Kind regards

Elanor

James Ker Monday Sep 09 at 11:43 AM

Hi,
I refer to your last step of dragging the apps bundle onto the device. However the apps is all greyed out when I tried to add it not the application area. The apps was working fine in the iOS simulator and the provisioning profile has been set up correctly. What do you think is the problem and how can I resolve it? Thanks.

Hanson Schmidt-Cornelius Monday Sep 09 at 02:22 PM

Hi James,

here are some suggestions that may help address the issue:
Depending on the version of xCode you are using, it is possible that the layout of the organizer window has changed. More recent versions of xCode have the app window on the top right.
You may also find that there is a green circle with a white "+" in it, next to the application name when you drag it onto the correct field.
Also note that the extension of the file you want to drag is ".app"
Hope this addresses the issue for you.

Kind Regards,

Hanson

James Ker Tuesday Sep 10 at 02:29 PM

Hi Hanson,

Thanks for your prompt reply.

Yes, I have mistaken the source code for the apps bundle. During the generation of the apps bundle, there is an error message when the checkboxes in the "Requirements and Restrictions" section are checked. Not sure why. Anyway, I was finally able to deployed the apps on my iPhone successfully.

Thank you.

Add your comment

E-Mail me when someone replies to this comment