{"id":940,"date":"2018-08-31T10:58:25","date_gmt":"2018-08-31T10:58:25","guid":{"rendered":"http:\/\/www.netexl.com\/blog\/?p=940"},"modified":"2026-04-02T09:50:28","modified_gmt":"2026-04-02T09:50:28","slug":"compile-cordova-app-for-ios","status":"publish","type":"post","link":"https:\/\/www.netexl.com\/blog\/compile-cordova-app-for-ios\/","title":{"rendered":"Compile Cordova App for iOS"},"content":{"rendered":"<p>I recently\u00a0planned to compile\u00a0my\u00a0Phaser games\u00a0for iOS App Store.\u00a0These games were build using Cordova CLI and have\u00a0already been published on Android Store so I already have a functioning game which\u00a0was to be ported to iOS. I decided to document the steps I had to follow to get my game compiled and published to\u00a0iOS App Store. You can develop the game on any platform of your liking but in order to compile and publish these games to iOS App Store you do need to have a Mac. It can not be done from Windows or any other platform.<\/p>\n<p>Steps to compile the game:<\/p>\n<ol>\n<li>Download MacOS installer for <a href=\"https:\/\/nodejs.org\/en\/download\/\" target=\"_blank\">Node.js<\/a>\u00a0and install it on your Mac.<\/li>\n<li>Go to App Store on your Mac and install latest version of XCode. You need XCode to build the game.<\/li>\n<li>Open Terminal console (Finder -&gt; Applications -&gt;Utilities) on your MacOS and install cordova using npm utility of Node.js by using the following command\n<pre class=\"lang:default decode:true\">sudo npm install -g cordova<\/pre>\n<\/li>\n<li>Create cordova project by using the following command\n<pre class=\"lang:default decode:true\">cordova create mygame com.games.mygame MyGame<\/pre>\n<\/li>\n<li>You will now have a mygame directory under \/Users\/&lt;Current User&gt; which will have skeleton project files of a cordova project.<\/li>\n<li>Copy your game code\u00a0in\u00a0<strong><em>www<\/em><\/strong> folder\u00a0under the cordova project folder.<\/li>\n<li>You would need to modify config.xml to configure your game settings.<\/li>\n<li>Go to project folder in Terminal console using following command\n<pre class=\"lang:default decode:true\">cd mygame<\/pre>\n<\/li>\n<li>Add ios platform in the project by using following command\n<pre class=\"lang:default decode:true\">cordova platform add ios\r\ncordova prepare<\/pre>\n<\/li>\n<li>This will import all plugins\u00a0and cordova code files required to build your app. Now\u00a0you can go the project folder and open the project in XCode and use it to build and test your app. Go to <strong><em>Finder<\/em><\/strong> and navigate to project folder on your MacOS. Go to platforms -&gt; ios folder and you will\u00a0find <strong><em>.xcodeproj.\u00a0<\/em><\/strong>Click <strong><em>.xcodeproj<\/em><\/strong> which will launch the app in XCode.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-942\" src=\"https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppXCodeProj.png\" alt=\"\" width=\"773\" height=\"439\" srcset=\"https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppXCodeProj.png 773w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppXCodeProj-300x170.png 300w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppXCodeProj-768x436.png 768w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppXCodeProj-280x159.png 280w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/li>\n<li>Once project opens in XCode, you can test the code by running it in a simulator.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-949\" src=\"https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppTest.png\" alt=\"\" width=\"923\" height=\"347\" srcset=\"https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppTest.png 923w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppTest-300x113.png 300w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppTest-768x289.png 768w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2018\/08\/MyiOSAppTest-280x105.png 280w\" sizes=\"auto, (max-width: 923px) 100vw, 923px\" \/><\/li>\n<li>In order to build the code and run it\u00a0on a device you need to go to Product -&gt; Destination\u00a0from XCode menu bar and select &#8220;Generic iOS Device&#8221;. Then build the application by going to Product -&gt; Build. In order to generate .ipa file to test on a device, go to Product -&gt; Archive which will generate archive and you can download it and then copy ipa file to your device and intstall it there.<\/li>\n<li>Creating developer build or production build requires you to create provisioning profiles for the two separate builds (one for development and one for production) and set these profiles in XCode. Without these profiles your build will fail. Profiles are not required if you just want to test the app in a simulator which is automatically packaged within XCode. Provisioning profiles can be created and downloaded from your Apple developer account.<br \/>\n<a href=\"https:\/\/developer.apple.com\" target=\"_blank\">https:\/\/developer.apple.com<\/a><\/li>\n<li>Once the archive is generated and downloaded, you can copy .ipa file to your device. I use this <a href=\"https:\/\/www.diawi.com\/\" target=\"_blank\">awesome service<\/a> which lets me upload the build on a server which I can download on my device using the generated URL and install for further testing.<\/li>\n<\/ol>\n<p>With these steps, you would be able to test your application for iOS device.<\/p>\n<h4>Additional Resources:<\/h4>\n<p><a href=\"https:\/\/cordova.apache.org\/docs\/en\/latest\/guide\/cli\/\" target=\"_blank\">Apache Cordova CLI Help<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently\u00a0planned to compile\u00a0my\u00a0Phaser games\u00a0for iOS App Store.\u00a0These games were build using Cordova CLI and have\u00a0already been published on Android Store so I already have a functioning game which\u00a0was to be ported to iOS. I decided to document the steps I had to follow to get my game compiled and published to\u00a0iOS App Store. You can develop the game on any platform of your liking but in order to compile and publish these games to iOS App Store you do need to have a Mac. It can not be done from Windows or any other platform. Steps to compile the game: Download MacOS installer for Node.js\u00a0and install it on your Mac. Go to App Store on your Mac and install latest version of XCode. You need XCode to build the game. Open Terminal console (Finder -&gt; Applications -&gt;Utilities) on your MacOS and install cordova using npm utility of Node.js by[&#8230;]<\/p>\n","protected":false},"author":5,"featured_media":1540,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,14,3,27,19],"tags":[],"class_list":["post-940","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cordova","category-how-to","category-html5","category-ios","category-mobile"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/comments?post=940"}],"version-history":[{"count":5,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/940\/revisions"}],"predecessor-version":[{"id":950,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/940\/revisions\/950"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/media\/1540"}],"wp:attachment":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/media?parent=940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/categories?post=940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/tags?post=940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}