The target of this article is to take some of my best practices and process flow and form a recipe for building a mobile app with the least amount of effort going into plumbing and setup.
## Technologies, frameworks etc
My favourite stack consists of the following:
– OS X running on some solid hardware and a good connection to the interweb
– XCode with the latest iOS SDK
– NodeJS and various packages to do some of the heavy lifting
– Titanium CLI to compile
– Titanium Alloy Framework to seperate concerns a bit (helps with keeping sane)
– Sublime Text 2 with a couple plugins and themed to make me feel warm and fuzzy inside
– [iTerm2](http://www.iterm2.com/#/section/home) for a better terminal experience
– An [Apple Developer](http://developer.apple.com) account ($99/annum)
– An account with [Installr](http://installrapp.com) and/or [TestFlight](testflightapp.com)
## Prep
#### Install [XCode 5](https://developer.apple.com/xcode/downloads/)
#### If the app will target **Android**
– Download the [Android SDK Tools](http://developer.android.com/sdk/index.html), no need for the ADK bundle, just the SDK Tools. Unpack and move it to your preferred folder.
– Download and extract the [Android NDK](http://developer.android.com/sdk/ndk/index.html) and add the path to your .bash_profile
– [Create an Android Emulator](http://docs.appcelerator.com/titanium/3.0/#!/guide/Native_Android_Debugging_and_Testing_Tools-section-29004938_NativeAndroidDebuggingandTestingTools-Creatinganemulator)
1 |
export ANDROID_NDK=~/android-ndk-r8 |
#### Install NodeJS
Install with Node Version Manager (nvm)
1 |
$ curl https://raw.githubusercontent.com/creationix/nvm/v0.17.3/install.sh | bash |
Ensure nvm is on the path with
1 |
source ~/.profile |
Install node stable
1 |
$ nvm install stable |
Copy the installed version of node to the /usr/local (where user installed global files should live on a linux VPS) and setting the permissions so that all users can access them.
1 |
$ n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local |
#### Install Titanium CLI
1 |
sudo npm install -g titanium |
Log in using your Appcelerator credentials
1 |
titanium login |
Install the latest released SDK
1 |
titanium sdk install |
Configure CLI
1 |
titanium setup quick |
#### Install [Alloy](http://docs.appcelerator.com/titanium/3.0/#!/guide/Alloy_Framework)
1 |
sudo npm install -g alloy |
#### Install [Sublime Text 2](http://www.sublimetext.com/2)
Install the [package manager](https://sublime.wbond.net/installation#st2)
Some really helpful packages you can install:
– Emmet
– SublimeLinter
– SublimeCodeIntel
– Titanium Build
– Titanium API Document
– Theme – Spacegray
#### Install [TiNy](https://github.com/fokkezb/tn)
1 |
sudo npm install -g tn --unsafe-perm |
## Create the app
1 2 3 |
ti create --name appname --id=com.domain.appname --platforms=android,ipad,iphone,mobileweb cd appname alloy new |
#### Write some awesome code
This is up to you.
#### Build and test
Easiest is to setup a new build system under Sublime’s Tools menu with the following:
1 2 3 4 5 6 7 8 9 |
{ //Adjust the --platform and other settings to your liking. "cmd": "ti build --platform ios --tall --retina --log-level trace --skip-js-minify", //We need to tell which path to use "path": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", "shell": true, //Enter the working dir for you app "working_dir": "$ProjectDir" } |
and in this case save it as Ti Build iPhone
or something matching your selection of CLI options.
Now Cmd+B
will build and run the iOS simulator.
#### Deploy to some testers
You’ll need to provision the app for ad-hoc distribution at the [iOS Dev Center](https://developer.apple.com/devcenter/ios/index.action)
Install the .mobileprovision
file by following the instructions and find the --pp-uuid
by peeking in your ~/Library/MobileDevice/Provisioning Profiles
folder and finding the filename of the newest .mobileprovision
file.
Your --distribution-name
will take the form "Name Surname (Team ID)"
which can be found [in your Apple Developer account summary page](https://developer.apple.com/membercenter/index.action#accountSummary)
##### TiNy recipes
See a list of predefined recipes
1 |
tn list |
Save your own
1 2 |
tn save my-app-installr adhoc F3BC7A7D-353D-4C99-B2CA-81A94E09A922 "Name Surname (2D82905F2L1)" --installr tn save my-app-appstore 467CCFA8-71A0-4196-9C02-06410A46FD3A "Name Surname (2D82905F2L1)" |
##### Clean
Clean up the build folder once in a while.
1 |
ti clean |
##### Ship for testers
1 |
tn my-app-installr |
##### Publish
1 |
tn my-app-appstore |