license: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This guide describes how to set up your development environment for Apache Cordova and run a sample Apache Cordova application.
lib/ios
Launch Terminal.app
Drag the bin folder (located in the permanent folder location of Cordova, from the “Install CordovaLib” section above) to the Terminal.app icon in your Dock, it should launch a new Terminal window
Type in ./create <project_folder_path> <package_name> <project_name>
then press “Enter”
<project_folder_path> is the path to your new Cordova iOS project (it must be empty if it exists) <package_name> is the package name, following reverse-domain style convention <project_name> is the project name
Locate your new project folder that you just created
Launch the .xcodeproj file in the folder
Change the Target in the Scheme drop-down menu on the toolbar to “HelloWorld” (your project name)
Change the Active SDK in the Scheme drop-down menu on the toolbar to iOS [version] Simulator
Select the Run button in your project window's toolbar
Open HelloWorld-Info.plist
, under the Resources group
Change BundleIdentifier to the identifier provided by Apple or your own bundle identifier
Change the Target in the Scheme drop-down menu on the toolbar to “HelloWorld” (your project name)
Change the Active SDK in the Scheme drop-down menu on the toolbar to [Your Device Name]
Select the Run button in your project window's toolbar
You should see the screen below, with a pulsating green “device is ready” message
If you have compilation problems related to missing headers, the build products should build into the same build directory. You may need to set the preference “Xcode Preferences -> Locations -> Derived Data -> Advanced…” to “Unique”. This is the default setting for Xcode on a fresh new install, if you upgraded from older versions of Xcode, you might have a legacy preference in there that you need to update.
You now have an Xcode project setup and you can build and run on the Simulator and device. It is important to understand that you do not need to use Xcode to write your web application. You can use your favourite text editor and simply rebuild your project using Xcode, or the command-line tools in your project folder (under the cordova sub-folder) Xcode will automatically detect the files that are changed in www
.
If you see this error: “Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.” Run this to set your Developer folder:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer