Build Cordova App On Mac

bridalnew
7 min readJun 24, 2021

Download here

Visual Studio Tools for Apache Cordova allow you to build cross-platform, multi-device hybrid apps using Apache Cordova. You can use the remotebuild agent with a Mac on your network to build, debug, run, and simulate an iOS version of your app. Many developers start their hybrid app development by testing on Android. Later in the development process, when the focus is mainly on verifying and polishing the UI for a set of core devices, they begin testing on iOS. The need to provide each developer on a team with a Mac for this final step is not cost effective. As an alternative to buying Macs, you can use a cloud hosting provider to build and debug your app in the iOS Simulator from a Windows machine, to debug native problems using Xcode, and to submit your app to iTunes using the Apple Application Loader. Cloud hosting providers charge a range of rates, some of which can be very cost effective (particularly if the majority of your development is done on a different platform). In this tutorial, we will describe how to configure Tools for Apache Cordova for use with one provider — MacInCloud.

Go to the directory where you maintain your source code, and create a cordova project: $ cordova create hello com.example.hello HelloWorld This creates the required directory structure for your cordova app. By default, the cordova create script generates a skeletal web-based application whose home page is the project’s www/index.html file. May 31, 2018 Cordova Build Settings for iOS with XCode 10 — Duration: 4:06. How to run cordova (or) Ionic apps to android Device or an emulator — Duration: 1:35. Sundaravel M 35,619 views. Xcode is now ready to be used with Cordova. The way this works that that you create and build a Cordova project, the build process generates an Xcode project, that you just double-click to open. When your project is open in Xcode, you can run it in the iOS simulator or deploy the app to a device.

Note

The steps shown here can be followed with other Mac hosting providers or with Macs in your own cloud facing datacenter. We recommend that you evaluate providers based on your organization’s needs.

Install remotebuild

To get started with MacInCloud, first set up either an account or a trial version. Make sure you enable the remote build port feature during checkout. Once you have provided your login information, connect to your Mac using Remote Desktop, and then you can set up remotebuild.

If you chose a MacInCloud plan with a dedicated server, you may have sudo (Administrator) access. With sudo access, just follow the same instructions used to install the remote agent on an on-premise Mac. If you are using a managed server plan, you will not have sudo access. However, it is worth noting that remotebuild is probably already installed on the machine that you have access to. You can validate this by attempting to start up the agent. In the Terminal App, type:

If it is not installed, contact MacInCloud support and ask them to install it on your behalf.

Configure Visual Studio to connect to your cloud hosted Mac

With one exception, you can use the same process to configure Visual Studio for use with MacInCloud as you do with your own Mac. The host name for MacInCloud is not available externally, so you can either override the host name used by the agent or use an IP address instead.

Build Cordova App

Note

remotebuild is not intended to be used as a traditional cloud-based service and you should make sure that you are in compliance with any Apple licensing terms that apply to your organization.

Option 1: To override the host name and configure Visual Studio

  1. Verify whether MacInCloud has already pre-configured your managed server for use with the remotebuild agent. If it is already pre-configured, a RemoteBuild.config file will already exist in your home directory and your agent is ready for use! To verify whether it is present and configured correctly, follow these steps.
  2. In the Terminal app on your MacInCloud server, try to open the file in Xcode by executing the following command.
  3. If the file exists, it will open in Xcode.
  4. If the previous command tells you the file does not exist, run the following commands in the Terminal app.
  5. Xcode starts with the config file open.
  6. Once RemoteBuild.config is open, verify that, at minimum, the following content is present in the file:
  7. and verify that the host name has been substituted with the host name you use to connect to MacInCloud. Any command line option can be specified this way in the config file, so you can also use this method to modify other settings such as the port used. Type remotebuild help to see a complete list of commands. Save the file if you make changes.
  8. After you verify the configuration, type the following command in the Terminal App on your Mac, substituting the MacInCloud host name for your_hostname in the command:
  9. Or
  10. Note
  11. If you are running an older version of the agent, the preceding command is not supported. Make sure that you update the remotebuild agent.
  12. Press “Y” and press Enter is prompted. You will now see the following information.
  13. If it is not already running, start the agent in the Terminal App on your Mac by typing:
  14. In Visual Studio, open Tools, Options, Tools for Apache Cordova, and then Remote Agent Configuration.
  15. Configure remote agent settings, mirroring the settings shown in the Terminal App.
  • Important: The Security PIN expires after 10 minutes by default. To generate a new PIN, see our documentation.
  1. That’s it. You are finished configuring the agent!

Instead of overriding the host name, you may instead use the IP address of your MacInCloud server.

Option 2: To get your IP address and configure Visual Studio

  1. In the Terminal App on your Mac, type the following command (make sure you include a space before the final quotation mark, as shown).
  2. Two IP addresses are displayed. In the steps that follow, you will need the IP address that is not the loopback address (127.0.0.1). For example, if typing the preceding command resulted in the following output, you will need 192.168.0.100.
  3. If it is not already running, start the agent in the Terminal App on your MacInCloud server by typing the following command.
  4. The first time you start the agent, you will see output similar to this.
  5. If you do not see this information, type the following to generate a new PIN:
  6. Be sure to restart the agent after generating the PIN if you shut it down.
  7. In Visual Studio, open Tools, Options, Tools for Apache Cordova, and then Remote Agent Configuration.
  8. Configure remote agent settings.
  9. Set Enable remote iOS processing to True, and configure Port and Security PIN using the output from the Terminal App. Instead of using the host name shown in the Terminal App, use the IP address you obtained previously and enter it in the Host field.
  10. Using an IP address to configure VS:
  11. That’s it. You are finished configuring the agent!

This guide shows how to set up your SDK development environment todeploy Cordova apps for OS X computers. See thefollowing for more detailed platform-specific information:

Cordova Build Android

The command-line tools above refer to versions prior to Cordova 3.0.See The Command-Line Interface for information about thecurrent interface.

Requirements and Support

Apple® tools required to build OS X applications run only on the OS Xoperating system on Intel-based Macs. Xcode® 6.0 (the minimum requiredversion) runs only on OS X version 10.9 (Mavericks) or greater, andincludes the OS X SDK (Software Development Kit). To submit apps tothe Apple App Store℠ requires the latest versions of the Apple tools.

You can test all of the Cordova features using the XCode or any otherIDE such as JetBrain’s AppCode, butyou need to use XCode to sign before submitting to theApp Store. To sign the apps, you must also be a member of Apple’sOS X Developer Program.

Install the SDK

There are two ways to download Xcode:

  • from the App Store,available by searching for ‘Xcode’ in the App Store application.
  • from Apple Developer Downloads,which requires registration as an Apple Developer.

Once Xcode is installed, several command-line tools need to be enabledfor Cordova to run. From the Xcode menu, select Preferences,then the Downloads tab. From the Components panel, press theInstall button next to the Command Line Tools listing.

Create a New Project

Use the cordova utility to set up a new project, as described in TheCordova The Command-Line Interface. For example, in a source-code directory:

Run the app

To run the app on your desktop:

And you should see a bordered window with the example app:

You can also use cordova run — help to see additional build and runoptions.

Open a Project in the SDK

Once osx platform is added to your project, you can open it fromwithin Xcode. Double-click to open the hello/platforms/osx/HelloWorld.xcodeprojfile. The screen should look like this:

TIPYou can also use the open command to open the XCode project directlyfrom the command line:

Common Problems

How To Build Cordova Ios App On Mac

Deprecation Warnings: When an application programming interface(API) is changed or replaced by another API, it is marked asdeprecated. The API still works in the near term, but is eventuallyremoved. Some of these deprecated interfaces are reflected in ApacheCordova, and Xcode issues warnings about them when you build anddeploy an application.

Missing Headers: Compilation errors relating to missing headersresult from problems with the build location, and can be fixedvia Xcode preferences:

  1. Select Xcode → Preferences → Locations.
  2. In the Derived Data section, press the Advanced button andselect Unique as the Build Location as shown here:

Cordova App Example

This is the default setting for a new Xcode install, but it may be setdifferently following an upgrade from an older version of Xcode.

For further information, consult Apple’s documentation:

Build Cordova App Ios Without Mac

  • Member Center home pageprovides links to several OS X technical resources includingtechnical resources, the provisioning portal, distribution guidesand community forums.
  • The xcode-select command,which helps specify the correct version of Xcode if more than one is installed.

(Mac®, OS X®, Apple®, Xcode®, App Store℠, iPad®, iPhone®, iPod® and Finder® are Trademarks of Apple Inc.)

Download here

--

--