Hi everyone! It’s been a little time since the last tutorial as some things are happening at a personal level, maybe I will have to slow down a bit, but nonetheless here is a new tutorial for you all! This time we are going to learn the basics to build your Moai apps for iOS, let’s get started!
Building for iOS requires using a Mac computer and XCode, for this tutorial I’m going to use an i5 Macbook Air and XCode 4.4.1, the latest one right now. Building for release on the App Store also requires having apple certificates and all your legal stuff setted up, I’m going to assume you already have that covered.
Creating a build folder
First off we’ll need to create a folder wich we’ll use to place our project and build from there. We’ll have to dig into our Moai SDK folder, and search for this path: moai-sdk/hosts/xcode. Here we’ll find two additional folders: osx and ios. What we should do to keep Moai stuff untouched is copy the ios folder and rename it, the same location will do but give it a reasonable name, I’m using iosbuild here.
Define our project location
We now have to edit a text file located inside our newly created folder, open mt.default with your preferred text editor and you should see just two lines in it:
What we are going to do is edit those lines to point where our project and our Moai folder are located, in my case, I have my project on my Desktop, in a folder called testProject and my Moai folder is inside my Applications folder, so after editing, my file looks like this:
Take notice dunkelgeist is my user name on my computer, so you should change that to fit yours in order to work properly.
After your first build a new file will appear on the same folder: moai-target. That file should also be changed for building other projects the same way mt.default was.
Getting into XCode
Now we are ready to open the Xcode project into our iosbuild folder. It’s greatly recommended changing the project name to whatever fits your app, so the final binary is properly named and easily identified.
Next step is setting the name we want our app to show under its icon, just follow the arrows and you’ll get there:
At this point we can perform a development build either for iOS Simulator or a device (if we plug it in first!) We just have to select our destination with the Scheme dropdown list and click Run:
Finally, if we are ready to throw our killer app to the App Store, we will need to define a bundle identifier matching the one used in our Apple’s provisioning profile. Something like com.companyname.appname. Again, follow the arrows to get to the exact point were we can change that:
That little process should do the trick! We are now ready to show the world our awesome creations!
Hope this tutorial has been useful and you send lots of awesome new Moai apps to the App Store pretty soon!