{"_id":"56d1f33d00a2a70b00b365e2","project":"5526c95cf69851170038b48f","user":"5564b8233b87582b003ab99b","version":{"_id":"56d1f33700a2a70b00b3658e","project":"5526c95cf69851170038b48f","__v":2,"createdAt":"2016-02-27T19:04:23.946Z","releaseDate":"2016-02-27T19:04:23.946Z","categories":["56d1f33900a2a70b00b3658f","56d1f33900a2a70b00b36590","56d1f33900a2a70b00b36591","56d1f33900a2a70b00b36592","56d1f33900a2a70b00b36593","56d1f33900a2a70b00b36594","56d1f33900a2a70b00b36595","56d1f33900a2a70b00b36596","56d1f33900a2a70b00b36597","56d1f33900a2a70b00b36598","56d1f33900a2a70b00b36599","56d1f33900a2a70b00b3659a","571f9497ada30c34003b7cee"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"beta","version_clean":"2.0.0-beta","version":"2.0.0-beta"},"__v":3,"parentDoc":null,"category":{"_id":"56d1f33900a2a70b00b36596","__v":1,"project":"5526c95cf69851170038b48f","pages":["56d1f33d00a2a70b00b365df","56d1f33d00a2a70b00b365e0","56d1f33d00a2a70b00b365e1","56d1f33d00a2a70b00b365e2"],"version":"56d1f33700a2a70b00b3658e","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-10-12T20:12:57.656Z","from_sync":false,"order":6,"slug":"ionic-package","title":"Ionic Package"},"updates":["563e5e6a77681a0d00d96a20","56c5e469d70fed0d00160d27","56e0525b4685db1700d947f3"],"next":{"pages":[],"description":""},"createdAt":"2015-10-07T15:59:40.296Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"Let's walk through generating a Package build for iOS. At the end of this guide, you will have successfully built an iOS `.ipa` file that you can install on an iOS device or submit to the App Store.\n\nWe'll cover development and production builds in this guide.\n\n* Start building for [development](#development-builds)\n* Start building for [production](#production-builds)\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"HTTP on iOS9 (setting NSAllowsArbitraryLoads to true)\",\n  \"body\": \"To allow regular HTTP (not HTTPS) connections on an iOS9 device, you'll need to set a line in `config.xml` that runs a hook. See [this section](package-usage#section-http-on-ios9) for details. In particular, this is necessary if you wish to use Ionic Deploy in your application.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Development Builds\"\n}\n[/block]\n## Queue a build\n\niOS requires a certificate and a provisioning profile for all builds, even development builds. If you haven't set up a development security profile for your app yet, head on over to the [iOS Credentials](doc:security-profiles#ios-credentials) docs to learn how to create a certificate and provisioning profile that you can tie to a [Security Profile](doc:security-profiles) for your app.\n\nTo start a build, type the following command. The `--profile` option is how you select which security profile to use for this build. Give it the tag of your security profile (instead of `PROFILE_TAG`, and it will use the iOS credentials associated with that profile.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ionic package build ios --profile PROFILE_TAG\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Security Profile Tag\",\n  \"body\": \"You'll notice in the above command that we have passed `PROFILE_TAG`. You should replace this with the tag that was assigned to the security profile you created. You can find the tag by running:\\n\\n`$ ionic security profiles list`\"\n}\n[/block]\nRunning that will bundle up your app and send it to our servers, where it will be sent into a build queue. This is important to know, because it means that your app is not built at the exact moment you run the command.\n\nYou should see some output like:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/R8ZsXozURyqXYLkXt87p_Screen%20Shot%202015-10-09%20at%203.40.03%20PM.png\",\n        \"Screen Shot 2015-10-09 at 3.40.03 PM.png\",\n        \"626\",\n        \"105\",\n        \"#349b22\",\n        \"\"\n      ],\n      \"caption\": \"Each time you run build you will be assigned a Build ID.\"\n    }\n  ]\n}\n[/block]\nTake note of the Build ID that your build is assigned. You'll reference this in other package commands.\n\n## Check the status\n\nOnce you have queued the build, you can check the status of your build by using the following command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ionic package list\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nYou should see a list of your latest builds, including the current **status** of that build.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/okHfyEUSwqHihSmLkqTJ_Screen%20Shot%202015-10-09%20at%203.38.26%20PM.png\",\n        \"Screen Shot 2015-10-09 at 3.38.26 PM.png\",\n        \"623\",\n        \"202\",\n        \"#7c9627\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou can alternatively see output for your exact build by running:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# make sure to replace BUILD_ID with the ID your build was assigned\\n$ ionic package info BUILD_ID\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n## Be patient...\n\nNow you need to wait... \n\nBecause this is in an alpha state, and we don't know how often you'll want to run builds or how large they will be, we're still fine-tuning the systems that produce the builds behind the scenes. Your build could be done in a few seconds, or it could take 30 minutes. \n\nTo get this in your hands as soon as possible, we have left out a notification system to let you know when your builds are complete (don't worry, we're definitely going to have one), but for now, you'll just need to keep checking the status of your build until you see it has failed or succeeded. \n\n## What to do when your build fails\n\nIf your build fails, you can get more information about the failure by running the info command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# make sure to replace the BUILD_ID with the build id you were assigned\\n$ ionic package info BUILD_ID\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThis may give you some information you can use to fix the build on your own, but if you get stuck, or you're just not sure what's wrong, feel free to reach us in our [Gitter.im](http://gitter.im/driftyco/ionic-io-testers) room.\n\n## Downloading your build\n\nOkay, so you've waited patiently, and your build status finally shows **success**...what now?\n\nWell, that's pretty much it. All that's left to do is download the IPA file we produced for you. You can do that by running:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# make sure to replace BUILD_ID with the build id you were assigned\\n$ ionic package download BUILD_ID\\n\\n# you can optionally specify a download folder\\n$ ionic package download BUILD_ID -d /folder/to/place/your/ipa\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThis will download a file named `APP_NAME.ipa`, where `APP_NAME` is the name listed in your `package.json` file.\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Success!\",\n  \"body\": \"You've now successfully built and downloaded a development build your of iOS app.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Production Builds\"\n}\n[/block]\n## Queue the build\n\nTo start a production build of your app for iOS, you can use the `ionic package build` command with the `ios` platform type and a `--release` flag. \n\nBut, before we dive into that command, you need to make sure to generate a new set of iOS credentials and create a new [Security Profile](doc:security-profiles), this time for **production**. If you try to build with a development security profile and the `--release` flag, it will not work! \n\nOnce you've got a profile with a certificate and provisioning profile attached, we can move on to actually queuing a build:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ionic package build ios --release --profile PROFILE_TAG\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThe rest of the process is identical to the [development build](doc:package-ios#development-builds) instructions, so please refer to those instructions if you haven't already gone through them.","excerpt":"","slug":"package-ios","type":"basic","title":"iOS"}
Let's walk through generating a Package build for iOS. At the end of this guide, you will have successfully built an iOS `.ipa` file that you can install on an iOS device or submit to the App Store. We'll cover development and production builds in this guide. * Start building for [development](#development-builds) * Start building for [production](#production-builds) [block:callout] { "type": "danger", "title": "HTTP on iOS9 (setting NSAllowsArbitraryLoads to true)", "body": "To allow regular HTTP (not HTTPS) connections on an iOS9 device, you'll need to set a line in `config.xml` that runs a hook. See [this section](package-usage#section-http-on-ios9) for details. In particular, this is necessary if you wish to use Ionic Deploy in your application." } [/block] [block:api-header] { "type": "basic", "title": "Development Builds" } [/block] ## Queue a build iOS requires a certificate and a provisioning profile for all builds, even development builds. If you haven't set up a development security profile for your app yet, head on over to the [iOS Credentials](doc:security-profiles#ios-credentials) docs to learn how to create a certificate and provisioning profile that you can tie to a [Security Profile](doc:security-profiles) for your app. To start a build, type the following command. The `--profile` option is how you select which security profile to use for this build. Give it the tag of your security profile (instead of `PROFILE_TAG`, and it will use the iOS credentials associated with that profile. [block:code] { "codes": [ { "code": "$ ionic package build ios --profile PROFILE_TAG", "language": "shell" } ] } [/block] [block:callout] { "type": "info", "title": "Security Profile Tag", "body": "You'll notice in the above command that we have passed `PROFILE_TAG`. You should replace this with the tag that was assigned to the security profile you created. You can find the tag by running:\n\n`$ ionic security profiles list`" } [/block] Running that will bundle up your app and send it to our servers, where it will be sent into a build queue. This is important to know, because it means that your app is not built at the exact moment you run the command. You should see some output like: [block:image] { "images": [ { "image": [ "https://files.readme.io/R8ZsXozURyqXYLkXt87p_Screen%20Shot%202015-10-09%20at%203.40.03%20PM.png", "Screen Shot 2015-10-09 at 3.40.03 PM.png", "626", "105", "#349b22", "" ], "caption": "Each time you run build you will be assigned a Build ID." } ] } [/block] Take note of the Build ID that your build is assigned. You'll reference this in other package commands. ## Check the status Once you have queued the build, you can check the status of your build by using the following command: [block:code] { "codes": [ { "code": "$ ionic package list", "language": "shell" } ] } [/block] You should see a list of your latest builds, including the current **status** of that build. [block:image] { "images": [ { "image": [ "https://files.readme.io/okHfyEUSwqHihSmLkqTJ_Screen%20Shot%202015-10-09%20at%203.38.26%20PM.png", "Screen Shot 2015-10-09 at 3.38.26 PM.png", "623", "202", "#7c9627", "" ] } ] } [/block] You can alternatively see output for your exact build by running: [block:code] { "codes": [ { "code": "# make sure to replace BUILD_ID with the ID your build was assigned\n$ ionic package info BUILD_ID", "language": "shell" } ] } [/block] ## Be patient... Now you need to wait... Because this is in an alpha state, and we don't know how often you'll want to run builds or how large they will be, we're still fine-tuning the systems that produce the builds behind the scenes. Your build could be done in a few seconds, or it could take 30 minutes. To get this in your hands as soon as possible, we have left out a notification system to let you know when your builds are complete (don't worry, we're definitely going to have one), but for now, you'll just need to keep checking the status of your build until you see it has failed or succeeded. ## What to do when your build fails If your build fails, you can get more information about the failure by running the info command: [block:code] { "codes": [ { "code": "# make sure to replace the BUILD_ID with the build id you were assigned\n$ ionic package info BUILD_ID", "language": "shell" } ] } [/block] This may give you some information you can use to fix the build on your own, but if you get stuck, or you're just not sure what's wrong, feel free to reach us in our [Gitter.im](http://gitter.im/driftyco/ionic-io-testers) room. ## Downloading your build Okay, so you've waited patiently, and your build status finally shows **success**...what now? Well, that's pretty much it. All that's left to do is download the IPA file we produced for you. You can do that by running: [block:code] { "codes": [ { "code": "# make sure to replace BUILD_ID with the build id you were assigned\n$ ionic package download BUILD_ID\n\n# you can optionally specify a download folder\n$ ionic package download BUILD_ID -d /folder/to/place/your/ipa", "language": "shell" } ] } [/block] This will download a file named `APP_NAME.ipa`, where `APP_NAME` is the name listed in your `package.json` file. [block:callout] { "type": "success", "title": "Success!", "body": "You've now successfully built and downloaded a development build your of iOS app." } [/block] [block:api-header] { "type": "basic", "title": "Production Builds" } [/block] ## Queue the build To start a production build of your app for iOS, you can use the `ionic package build` command with the `ios` platform type and a `--release` flag. But, before we dive into that command, you need to make sure to generate a new set of iOS credentials and create a new [Security Profile](doc:security-profiles), this time for **production**. If you try to build with a development security profile and the `--release` flag, it will not work! Once you've got a profile with a certificate and provisioning profile attached, we can move on to actually queuing a build: [block:code] { "codes": [ { "code": "$ ionic package build ios --release --profile PROFILE_TAG", "language": "shell" } ] } [/block] The rest of the process is identical to the [development build](doc:package-ios#development-builds) instructions, so please refer to those instructions if you haven't already gone through them.