Build the app file for iOS

From Color Infection Wiki
Jump to: navigation, search

For your first app

  1. make sure the development tools are installed (Install devlopement tools).
  2. run git clone to get the app template project (in parent folder of the to-be-created project folder). All below commands should run in the project folder.
    • on Windows, you should run it in a git shell window, which can be opened in the context menu of a folder view in File Explorer.
    • this template project will be updated often, later, you can run git pull in the project folder to update it.
  3. download the latest ANE file from, and put it in the etc/anes folder under the project folder and change its name to PhyardAneAll.ane.
    • this file will also be updated often, so before building a new app release, please re-download this file.
    • if your app don't need AdMob and other extended features, this file is not needed.
  4. duplicate the demo folder and rename the new folder, such as "app-MyAppName", we call it app folder below.
  5. there is a app.config.txt file in the app folder. You can change the app settings in it.
    • set the AIR SDK path for your current OS only
    • app version should be larger or equals 1.0.0
  6. download your design SWF file of your design (the for-building-ios-app one) from the design revision page on Phyard, and put it under the app folder and rename it the same as the value App.Input.SWF.File assigned in app.config.txt.
  7. modify the icons under the app folder as needed, don't change their sizes and names.
  8. register as an iOS app developer at ($99 per year).
  9. create the two developer certificates, one is for development, which is not very useful, the other is for distribution (AdHoc release and final AppStore release)
    • the certificate will expire in one year, you need re-create them one year later (and renew your developer account)
    • steps for how to create certificates (on Windows, open a git shell window to run following commends):
      1. openssl genrsa -out certificate_development.key 2048
      2. openssl genrsa -out certificate_distribution.key 2048
      3. openssl req -new -key certificate_development.key -out CertificateSigningRequest_development.certSigningRequest -subj "/, CN=John Doe, C=US"
      4. openssl req -new -key certificate_distribution.key -out CertificateSigningRequest_distribution.certSigningRequest -subj "/, CN=John Doe, C=US"
        • emailAddress is your email, CN is your name, C is your country code.
      5. log into, then create the two certificates by uploading the two just created CSR files: CertificateSigningRequest_development.certSigningRequest and CertificateSigningRequest_distribution.certSigningRequest. Apple will spend several minutes to create the certificate files. Download them (ios_development.cer and ios_distribution.cer) when they are ready and put them in the cert folder under the project folder. Then convert the two download certificate files to P12 format by run
      6. openssl x509 -in ios_development.cer -inform DER -out ios_development.pem -outform PEM
      7. openssl x509 -in ios_distribution.cer -inform DER -out ios_distribution.pem -outform PEM
      8. openssl pkcs12 -export -inkey certificate_development.key -in ios_development.pem -out ios_development.p12
      9. openssl pkcs12 -export -inkey certificate_distribution.key -in ios_distribution.pem -out ios_distribution.p12
      10. only the final two files ios_development.p12 and ios_distribution.p12 will be used in building process, they must be put in the cert folder (other files to create the final two files should also be put there, don't delete them).
  10. find the device ID of your iOS device and register it as device at
  11. create an app ID at for your app, then create and download the mobile provision files for your app and put them in the provisions folder under the app folder.
    • there are 3 mobile provision files to be created: the development one, the AdHoc distribution one and App Store distributon one.
    • the three provision files should be set in app.config.txt
    • when creating the the development one, the AdHoc distribution one, your device ID is needed.
  12. create a file named app.txt under the project folder, add a line = app-MyAppName in it.
    • a line starts with # in this file is a comment line and will be ignored.
    • later, you may add more new apps in the project folder, such as "app-MyApp2" then you can add a new = app-MyApp2 in it. The last line will be used, if it is not a comment line.
  13. run ant release and input the certificate password to build a release for your app (for Apple App Store).
    • the output file is placed in bin folder under the project folder.
    • gnerally, a building needs one and a half minutes to finish.
    • the build script will increase the version number automatically. You can also manually modify it in app.config.txt
    • before building the app release file, you can run ant test to test your app, but the behavior would be some different from the real mobile devices.
    • you should run ant adhoc to create an AdHoc release to install it on your iOS device to test it before uploading it to Apple App Store.
  14. manage your app description and screen shots at: (with the same iOS developer account)
    • you should also need to change the app status to "ready for upload" before uploading a new app release.
  15. upload your app binary file to Apple App Store with the Application Loader, which is a Mac only program.

For your non-first app

  1. run git pull under the project folder to update the build script (you should also update the project when rebuild an old app)
  2. if the extended feature is needed, re-download the latest ANE file from, and put it in the etc/anes folder under the project folder and change its name to PhyardAneAll.ane.
  3. duplicate the demo folder or one old existed app folder and rename the new folder, such as "app-MyApp2", we call it new app folder below.
  4. modify the app.config.txt file in the new app folder as needed.
  5. create an app ID at for the new app. The new app will use the same certificates as the old ones, but the mobile provision files are app related, so you need create and download the mobile provision files for the new app and put them in the provisions folder under the new app folder.
    • set the new three provision files in app.config.txt
  6. add a line = app-MyApp2 at the end of the app.txt file under project folder.
  7. build and manage and upload

Install app release on Android test device

After your app (built with ant release) is published on Apple App Store, you can download it there. Before the publishing, you can drag your app AdHoc mobile provision file and the app .ipa file (built with ant adhoc) into iTunes, and plug your iOS device with PC or Mac through USB cable then sync your iOS device to install the .ipa file on your iOS device.