Upgrading iOS
This guide shows how to modify iOS projects to upgrade from older
versions of Cordova. Most of these instructions apply to projects
created with an older set of command-line tools that precede the
cordova CLI utility. See The Command-Line Interface for information
how to update the version of the CLI.
NOTE: Xcode 6 is required. Currently, to submit to the Apple App Store, you should use the latest shipped version of the iOS SDK, which is iOS 8 and this is included only with Xcode 6.
Upgrading 3.6.0 Projects to 4.0.0
For non-CLI projects, run:
bin/update path/to/project
For CLI projects:
-
Update the
cordovaCLI version. See The Command-Line Interface. -
Run
cordova platform update iosin your existing projects.
Upgrading 3.3.0 Projects to 3.4.0
For non-CLI projects, run:
bin/update path/to/project
For CLI projects:
-
Update the
cordovaCLI version. See The Command-Line Interface. -
Run
cordova platform update ios
Upgrading 3.2.0 Projects to 3.3.0
For non-CLI projects, run:
bin/update path/to/project
For CLI projects:
-
Update the
cordovaCLI version. See The Command-Line Interface. -
Run
cordova platform update ios
Upgrading 3.1.0 Projects to 3.2.0
For non-CLI projects, run:
bin/update path/to/project
For CLI projects:
-
Update the
cordovaCLI version. See The Command-Line Interface. -
Run
cordova platform update ios
Upgrading 3.0.0 Projects to 3.1.0
For non-CLI projects, run:
bin/update path/to/project
For CLI projects:
-
Update the
cordovaCLI version. See The Command-Line Interface. -
Run
cordova platform update ios
iOS 7 Issues:
-
Remove
width=device-width, height=device-heightfrom theindex.htmlfile'sviewportmetatag. (See the relevant bug.) -
Update your media, media-capture and splashscreen core plugins for iOS 7 support.
Xcode 5 Issues:
-
Update your Project Settings if Xcode 5 prompts you to do so (in the Issues Navigator).
-
Update your Compiler for C/C++/Objective-C setting, under the Build Settings tab, Build Options section. Choose Default compiler (Apple LLVM 5.0).
Upgrade to the CLI (3.0.0) from 2.9.0
-
Create a new Apache Cordova 3.0.0 project using the cordova CLI, as described in The Command-Line Interface.
-
Add your platforms to the cordova project, for example:
cordova platform add ios. -
Copy the contents of the project's
wwwdirectory to thewwwdirectory at the root of the cordova project you just created. -
Copy or overwrite any native assets from your original project (
Resources, etc.), making sure to add any new files to the.xcodeprojproject. The iOS project builds inside theplatforms\iosdirectory. -
Copy the
config.xmlinto thewwwdirectory, and remove any plugin definitions. Modify settings here instead of the platform directory. -
Use the cordova CLI tool to install any plugins you need. Note that the CLI handles all core APIs as plugins, so they may need to be added. Only 3.0.0 plugins are compatible with the CLI.
-
Build and test.
Upgrading 2.9.0 Projects to 3.0.0
-
Download and extract the Cordova 3.0.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-3.0.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova.js(note that it does not have a version suffix anymore, the version is in the file itself in the header) file from the new project into thewwwdirectory, and delete thewww/cordova.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova.jsfile. -
Delete the
CordovaLibdirectory, and copy theCordovaLibdirectory from the new project into your project's root directory.
NOTE: Starting with Cordova 3.0.0, plugins are not pre-installed,
and you need to use the plugman command-line utility to install them
yourself. See Using Plugman to Manage Plugins.
Upgrading 2.8.0 Projects to 2.9.0
-
Download and extract the Cordova 2.9.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.9.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova.js(note that it does not have a version suffix anymore, the version is in the file itself in the header) file from the new project into thewwwdirectory, and delete thewww/cordova.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova.jsfile. -
Delete the
CordovaLibdirectory, and copy theCordovaLibdirectory from the new project into your project's root directory.
Upgrading 2.7.0 Projects to 2.8.0
-
Download and extract the Cordova 2.8.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.8.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova.js(note that it does not have a version suffix anymore, the version is in the file itself in the header) file from the new project into thewwwdirectory, and delete thewww/cordova-2.7.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova.jsfile. -
Update any
<plugin>tags in theconfig.xmlfile to<feature>tags. Note that existing<plugin>tags still work, but are deprecated. You can copy this information in theconfig.xmlfile for a new project. For example:<plugins> <plugin name="LocalStorage" value="CDVLocalStorage" /> <!-- other plugins --> </plugins> <!-- change to: (note that a <feature> tag is on the same level as <plugins> --> <feature name="LocalStorage"> <param name="ios-package" value="CDVLocalStorage" /> </feature> <!-- other <feature> tags --> -
Delete the
CordovaLibdirectory, and copy theCordovaLibdirectory from the new project into your project's root directory. -
Add these two frameworks to your project:
OpenAL ImageIO -
Update your project's target Build Settings. Under Linking → Other Linker Flags, edit "-Obj-C" to be "-ObjC".
-
Update your project's target Build Settings. Under Linking → Other Linker Flags, change "-all_load" to be
-force\_load ${BUILT\_PRODUCTS\_DIR}/libCordova.a. You would only need to do this if you have the problem defined in this issue..
Upgrading 2.6.0 Projects to 2.7.0
-
Download and extract the Cordova 2.7.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.7.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. you need the assets from this new project.
-
Copy the
www/cordova-2.7.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-2.6.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-2.7.0.jsfile. -
Update (or replace, if you never changed the file) the
AppDelegate.mfile according to the one from the new project (see this diff). -
In the
config.xmlfile, remove this line. -
Delete the
CordovaLibdirectory, and copy theCordovaLibdirectory from the new project into your project's root directory.
Upgrading 2.5.0 Projects to 2.6.0
-
Download and extract the Cordova 2.6.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.6.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the project's
www/cordova-2.6.0.jsfile into thewwwdirectory, and delete thewww/cordova-2.5.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (along with any other files that reference the script) to refer to the newcordova-2.6.0.jsfile. -
Update (or replace, if you never changed the file) the
AppDelegate.mfile according to the one from the new project (see this diff). -
In the
config.xmlfile, add this new line. -
In the
config.xmlfile, add this new line. -
In the
config.xmlfile, UIWebViewBounce has been changed to DisallowOverscroll, and default values are different. -
In the
config.xmlfile, theEnableLocationpreference has been deprecated. -
Delete the
CordovaLibdirectory, and copy theCordovaLibdirectory from the new project into your project's root directory.
Upgrading 2.4.0 Projects to 2.5.0
-
Download and extract the Cordova 2.5.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.5.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova-2.5.0.jsfile from the new project into thewwwdirectory and delete thewww/cordova-2.4.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-2.5.0.jsfile. -
Update (or replace, if you never changed the file) the
AppDelegate.mfile according to the one from the new project (see this diff). -
In the
config.xmlfile, add these new lines. -
In the
config.xmlfile, edit the root element, change it from cordova to widget. -
In the
config.xmlfile, remove the OpenAllWhitelistURLsInWebView preference. -
Delete the
cordovadirectory, and copy thecordovadirectory from the new project into your project's root directory. In 2.5.0, this has updated scripts. -
Delete the
CordovaLibdirectory, and copy theCordovaLibdirectory from the new project into your project's root directory.
Upgrading 2.3.0 Projects to 2.4.0
-
Download and extract the Cordova 2.4.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.4.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova-2.4.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-2.3.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-2.4.0.jsfile. -
Update (or replace, if you never changed the files) the
MainViewController.mfile according to the one from the new project (see this diff). -
Update (or replace, if you never changed the file) the
AppDelegate.mfile according to the one from the new project (see this diff). -
In the
config.xmlfile, add this new line. -
Delete the
cordovadirectory, and copy thecordovadirectory from the new project into your project's root directory. In 2.4.0, this has fixed scripts. -
Delete the
CordovaLibdirectory, and copy theCordovaLibdirectory from the new project into your project's root directory. -
Add AssetsLibrary.framework as a resource to your project. (See Apple's documentation for instructions on how to do so.).
Upgrading 2.2.0 Projects to 2.3.0
-
Download and extract the Cordova 2.3.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.3.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova-2.3.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-2.2.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-2.3.0.jsfile. -
Update (or replace, if you never changed the file) the
MainViewController.maccording to the one from the new project. -
Delete the
cordovadirectory, and copy thecordovadirectory from the new project into your project's root directory. In 2.3.0, this has new scripts. -
Delete the
CordovaLibdirectory, and copy theCordovaLibdirectory from the new project into your project's root directory. -
Convert the
Cordova.plistfile toconfig.xml, by running the scriptbin/cordova\_plist\_to\_config\_xmlon your project file. -
Add the InAppBrowser plugin to the
config.xml, by adding this tag under<cordova><plugins>:<plugin name="InAppBrowser" value="CDVInAppBrowser" /> -
Note that Objective-C plugins are not whitelisted anymore. To whitelist your connections with the app whitelist, you need to set the
User-Agentheader of the connection to the same user-agent as the main Cordova WebView. You can get this by accessing theuserAgentproperty off the main view-controller. The main view-controller (CDVViewController) also has aURLisAllowedmethod for you to check whether a URL passes the whitelist. -
Device API changes:
- For iOS, device.platform used to return
iPhone,iPadoriPod Touch; now it returns (correctly)iOS. - For iOS, device.name (now deprecated for all platforms) used to return the name of the user’s device (e.g. ‘Shazron’s iPhone 5′); now it returns what device.platform used to return:
iPhone,iPadoriPod Touch. - For all platforms, there is a new property called device.model; this returns the specific device model, e.g.
iPad2,5(for other platforms, this returns what device.name used to return).
- For iOS, device.platform used to return
Upgrading 2.1.0 Projects to 2.2.0
-
Download and extract the Cordova 2.2.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.2.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova-2.2.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-2.1.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-2.2.0.jsfile. - Update (or replace, if you never changed the file) the
MainViewController.maccording to the one from the new project:- Updated → viewWillAppear
-
Copy the
cordovadirectory from the new project into your project's root directory. In 2.2.0, this has an updated 'emulate' script. - Next, update the
CordovaLibsub-project reference. Beginning with Cordova 2.1.0, we are not using the CORDOVALIB Xcode variable anymore when referencing whereCordovaLibresides, the reference is an absolute file reference now.- Launch Terminal.app
- Go to the location where you installed Cordova (see Step 1), in the
binsubdirectory -
Run the script below where the first parameter is the path to your project's
.xcodeprojfile:update_cordova_subproject path/to/your/project/xcodeproj
NOTE: In 2.2.0, the bin/create script copy in the CordovaLib sub-project into your project. To have the same kind of setup, just copy in the right CordovaLib into your project directory, and update the CordovaLib sub-project location (relative to the project) in the Xcode File Inspector.
Upgrading 2.0.0 Projects to 2.1.0
With Cordova 2.1.0, CordovaLib has been upgraded to use Automatic Reference Counting (ARC). You don't need to upgrade to ARC to use CordovaLib, but if you want to upgrade your project to use ARC, please use the Xcode migration wizard from the menu: Edit → Refactor → Convert to Objective-C ARC…, de-select libCordova.a, then run the wizard to completion.
-
Download and extract the Cordova 2.1.0 source to a permanent directory location on your hard drive, for example to
~/Documents/Cordova-2.1.0. -
Quit Xcode if it is running.
-
Using Terminal.app, navigate to the directory where you put the downloaded source above.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova-2.1.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-2.0.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-2.1.0.jsfile. - Update (or replace, if you never changed the file) the
AppDelegate.maccording to the one from the new project:- Edited → application:didFinishLaunchingWithOptions:
- Added → application:supportedInterfaceOrientationsForWindow:
- Update (or replace, if you never changed the file) the
MainViewController.maccording to the one from the new project:- Added → viewWillAppear
-
Copy the
cordovadirectory from the new project into your project's root directory. In 2.1.0, this has the updated scripts to support paths with spaces. -
Remove the
VERSIONfile reference from your project (not the one inCordovaLib). - Next, update the
CordovaLibsub-project reference. Beginning with Cordova 2.1.0, we are not using the CORDOVALIB Xcode variable anymore when referencing whereCordovaLibresides, the reference is an absolute file reference now.- Launch Terminal.app
- Go to the location where you installed Cordova (see Step 1), in the
binsubdirectory -
Run the script below where the first parameter is the path to your project's
.xcodeprojfile:update_cordova_subproject path/to/your/project/xcodeproj
Upgrading 1.9.0 Projects to 2.0.0
-
Install Cordova 2.0.0.
-
Create a new project, as described in iOS Shell Tool Guide. You need the assets from this new project.
-
Copy the
www/cordova-2.0.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-1.9.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-2.0.0.jsfile. -
Copy the
cordovadirectory from the new project into your project's root directory (if you want the project command-line tools). -
Add a new entry under
Pluginsin theCordova.plistfile, under the Supporting Files group. The key isDeviceand the value isCDVDevice. -
Remove
Cordova.framework. -
Remove
verify.shfrom the Supporting Files group. -
Select the project icon in the Project Navigator, select your project Target, then select the Build Settings tab.
-
Search for Preprocessor Macros, then remove all CORDOVA_FRAMEWORK=1 values.
-
Locate the
CordovaLibdirectory that was installed in your hard-drive under your home folder'sDocumentssubdirectory. -
Locate the
CordovaLib.xcodeprojfile in theCordovaLibdirectory, then drag and drop the file into your project. It should appear as a sub-project. -
Build your project, you should get some errors relating to
#importdirectives. -
For the
#importerrors, change any quote-based imports in this style:#import "CDV.h"to this brackets-based style:
#import <Cordova/CDV.h>and remove any
#ifdefwrappers around any Cordova imports, they are not needed anymore (the imports are now unified) -
Build your project again, and it should not have any
#importerrors. -
Select the project icon in the Project Navigator, select your project Target, then select the Build Phases tab.
-
Expand the Target Dependencies phase, then select the + button.
-
Select the
CordovaLibtarget, then select the Add button. -
Expand the first Link Binary with Libraries phase (it should already contain a bunch of frameworks), then select the + button.
-
Select the
libCordova.astatic library, then select the Add button. -
Delete the Run Script phase.
-
Select the project icon in the Project Navigator, select your project Target, then select the Build Settings tab.
-
Search for Other Linker Flags, and add the values -force_load and -Obj-C.
-
Expand the
CordovaLibsub-project. -
Locate the
VERSIONfile, drag it into your main project (we want to create a link to it, not a copy). -
Select the Create groups for any added folders radio button, then select the Finish button.
-
Select the
VERSIONfile that you just dragged in a previous step. -
Type the Option-Command-1 key combination to show the File Inspector (or menuitem View → Utilities → Show File Inspector).
-
Choose Relative to CORDOVALIB in the File Inspector for the drop-down menu for Location.
-
Set the Xcode preference Xcode Preferences → Locations → Derived Data → Advanced… to Unique, so that the unified headers can be found.
-
Select the project icon in the Project Navigator, select your Target, then select the Build Settings tab.
-
Search for Header Search Paths. For that setting, append these three values, including quotes:
"$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(BUILT_PRODUCTS_DIR)" -
Search for Other Linker Flags. For that setting, append this value:
-weak_framework CoreFoundation -
Build your project, it should compile and link with no issues.
-
Select your project from the Scheme drop-down, and then select iPhone 5.1 Simulator.
-
Select the Run button.
NOTE: If your project is not working as expected in the Simulator, please take a note of any errors in the console log in Xcode for clues.
Upgrading 1.8.x Projects to 1.9.0
-
Install Cordova 1.9.0.
-
Create a new project. You will need some of the assets from this new project.
-
Copy the
www/cordova-1.9.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-1.8.x.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-1.9.0.jsfile.
NOTE: 1.9.0 supports the new BackupWebStorage boolean Cordova.plist setting. It's enabled by default, so set it to
false to disable it, especially on iOS 6. See Release Notes: Safari and UIKit Section
Upgrading 1.7.0 Projects to 1.8.x
-
Install Cordova 1.8.0.
-
Create a new project. You will need some of the assets from this new project.
-
Copy the
www/cordova-1.8.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-1.7.x.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-1.8.0.jsfile.
If you intend on using the Capture API, you will need the new iPad retina-display assets:
-
Copy the
Resources/Capture.bundleitem from the new project into your project directory, over-writing your existingResources/Capture.bundleitem. -
In your project, select the
Capture.bundleitem into your Project Navigator in Xcode, type the Delete key, then select Remove Reference from the resulting dialog. -
Drag the new
Capture.bundlefrom Step 1 above into your Project Navigator in Xcode, then select the Create groups for any added folders radio button.
Upgrading 1.6.x Projects to 1.7.0
-
Install Cordova 1.7.0.
-
Create a new project. You will need some of the assets from this new project.
-
Copy the
www/cordova-1.7.0.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-1.6.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-1.7.0.jsfile.
Upgrading 1.5.0 Projects to 1.6.x
-
Install Cordova 1.6.1.
-
Make a backup of
AppDelegate.m,AppDelegate.h,MainViewController.m,MainViewController.h, andCordova.plistin your project. -
Create a new project. You will need some of the assets from this new project.
-
Copy these files from the new project into your 1.5.0-based project directory on disk, replacing any old files (backup your files first from step 2 above):
AppDelegate.h AppDelegate.m MainViewController.h MainViewController.m Cordova.plist -
Add all the new
MainViewControllerandAppDelegatefiles into your Xcode project. -
Copy the
www/cordova-1.6.1.jsfile from the new project into thewwwdirectory, and delete thewww/cordova-1.5.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newcordova-1.6.1.jsfile. -
Add the new
Cordova.plistfile into your project. This is necessary because the core plugin service names must change to match the ones from Android and BlackBerry, for a unified Cordova JavaScript file (cordova-js). -
Integrate any settings, Plugins and ExternalHosts entries that you had in your backed-up Cordova.plist into the new
Cordova.plist. -
Integrate any project-specific code that you have in your backed-up
AppDelegate.handAppDelegate.minto the newAppDelegatefiles. AnyUIWebViewDelegateorCDVCommandDelegatecode inAppDelegate.mneeds to go intoMainViewController.mnow (see commented-out sections in that file). -
Integrate any project-specific code that you have in your backed-up
MainViewController.handMainViewController.minto the new MainViewController files. -
Click on the project icon in the Project Navigator, select your Project, then select the Build Settings tab.
-
Enter Compiler for C/C++/Objective-C in the search field.
-
Select the Apple LLVM Compiler 3.1 value.
Upgrading 1.4.x Projects to 1.5.0
-
Install Cordova 1.5.0.
-
Create a new project and run it once. You will need some of the assets from this new project.
-
Copy the
www/cordova-1.5.0.jsfile from the new project into thewwwdirectory, and delete thewww/phonegap-1.4.x.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the new Cordovacordova-1.5.0.jsfile. -
Find
PhoneGap.frameworkin your Project Navigator, select it. -
Type the Delete key and delete the
PhoneGap.frameworkreference in the Project Navigator. -
Type the Option-Command-A key combination, which should drop down a sheet to add files to your project (the Add Files… sheet). Make sure the Created groups for any added folders radio button is selected.
-
Type the Shift-Command-G key combination, which should drop down another sheet for you to go to a folder (the Go to the folder: sheet).
-
Enter
/Users/Shared/Cordova/Frameworks/Cordova.frameworkin the Go to the folder: sheet and then press the Go button. -
Press the Add button in the Add Files… sheet.
-
Select
Cordova.frameworkin the Project Navigator. -
Type the Option-Command-1 key combination to show the File Inspector.
-
Choose Absolute Path in the File Inspector for the drop-down menu for Location.
-
Type the Option-Command-A key combination, which should drop down a sheet to add files to your project (the Add Files… sheet). Make sure the Created groups for any added folders radio button is selected.
-
Type the Shift-Command-G key combination, which should drop down another sheet for you to go to a folder (the Go to the folder: sheet).
-
Enter
~/Documents/CordovaLib/Classes/deprecatedin the Go to the folder: sheet and then press the Go button. -
Press the Add button in the Add Files… sheet.
-
In the
AppDelegate.h,AppDelegate.m, andMainViewController.hfiles, replace the whole#ifdef PHONEGAP_FRAMEWORKblock with:#import "CDVDeprecated.h" -
Click on the project icon in the Project Navigator, select your Target, then select the Build Settings tab.
-
Search for Framework Search Paths.
-
Replace the existing value with
/Users/Shared/Cordova/Frameworks. -
Search for Preprocessor Macros.
-
For the first (combined) value, replace the value with CORDOVA_FRAMEWORK=YES.
-
Select the Build Phases tab.
-
Expand Run Script.
-
Replace any occurrences of PhoneGap with Cordova.
-
Find the
PhoneGap.plistfile in the Project Navigator, and click on the filename once to enter name edit mode. -
Rename
PhoneGap.plisttoCordova.plist. -
Right-click on
Cordova.plistand choose Open As → Source Code. -
Press Option-Command-F, choose Replace from the drop-down on the top left of the Source window.
-
Enter
com.phonegapfor the Find string, andorg.apache.cordovafor the Replace string, then press the Replace All button. -
Enter PG for the Find string, and CDV for the Replace string, then press the Replace All button.
-
Press Command-B to build. You still have deprecations that you can get rid of in the future (see
CDVDeprecated.h. For example, replace classes in your code that use PG* to CDV*).
Upgrading 1.4.0 Projects to 1.4.1
-
Install Cordova 1.4.1.
-
Make a backup of
MainViewController.m. -
Create a new project. You will need some of the assets from this new project.
-
Copy the
MainViewController.mfile from the new project into your 1.4.0-based project directory on disk, replacing the old file (backup your files first from step 2 above). -
Add the
MainViewController.mfile into your Xcode project. -
Integrate any project-specific code that you have in your backed-up
MainViewController.minto the new file. -
Updating the
phonegap-1.4.0.jsfile is optional, nothing has changed in the JavaScript between 1.4.0 and 1.4.1.
Upgrading 1.3.0 Projects to 1.4.0
-
Install Cordova 1.4.0.
-
Make a backup of
AppDelegate.mandAppDelegate.hin your project. -
Create a new project. You will need some of the assets from this new project.
-
Copy these files from the new project into your 1.3.0-based project directory on disk, replacing any old files (backup your files first from step 2 above):
AppDelegate.h AppDelegate.m MainViewController.h MainViewController.m MainViewController.xib -
Add all the
MainViewControllerfiles into your Xcode project. -
Copy the
www/phonegap-1.4.0.jsfile from the new project into thewwwdirectory, and delete thewww/phonegap-1.3.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newphonegap-1.4.0.jsfile. -
Add a new entry under
Pluginsin thePhoneGap.plistfile. The key iscom.phonegap.batteryand the value isPGBattery. -
Integrate any project-specific code that you have in your backed-up
AppDelegate.handAppDelegate.minto the new AppDelegate files.
Upgrading 1.2.0 Projects to 1.3.0
-
Install Cordova 1.3.0.
-
Make a backup of
AppDelegate.mandAppDelegate.hin your project. -
Create a new project. You will need some of the assets from this new project.
-
Copy these files from the new project into your 1.2.0-based project directory on disk, replacing any old files (backup your files first from step 2 above):
AppDelegate.h AppDelegate.m MainViewController.h MainViewController.m MainViewController.xib -
Add all the
MainViewControllerfiles into your Xcode project. -
Copy the
www/phonegap-1.3.0.jsfile from the new project into thewwwdirectory, and delete thewww/phonegap-1.2.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newphonegap-1.3.0.jsfile. -
Add a new entry under
Pluginsin thePhoneGap.plistfile. The key iscom.phonegap.batteryand the value isPGBattery. -
Integrate any project-specific code that you have in your backed-up
AppDelegate.handAppDelegate.minto the new AppDelegate files.
Upgrading 1.1.0 Projects to 1.2.0
-
Install Cordova 1.2.0.
-
Make a backup of
AppDelegate.mandAppDelegate.hin your project. -
Create a new project. You will need some of the assets from this new project.
-
Copy these files from the new project into your 1.1.0-based project directory on disk, replacing any old files (backup your files first from step 2 above):
AppDelegate.h AppDelegate.m MainViewController.h MainViewController.m MainViewController.xib -
Add all the
MainViewControllerfiles into your Xcode project. -
Copy the
www/phonegap-1.2.0.jsfile from the new project into thewwwdirectory, and delete thewww/phonegap-1.1.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newphonegap-1.2.0.jsfile. -
Add a new entry under
Pluginsin thePhoneGap.plistfile. The key iscom.phonegap.batteryand the value isPGBattery. -
Integrate any project-specific code that you have in your backed-up
AppDelegate.handAppDelegate.minto the new AppDelegate files.
Upgrading 1.0.0 Projects to 1.1.0
-
Install Cordova 1.1.0.
-
Make a backup of
AppDelegate.mandAppDelegate.hin your project. -
Create a new project. You will need some of the assets from this new project.
-
Copy these files from the new project into your 1.0.0-based project directory on disk, replacing any old files (backup your files first from step 2 above):
AppDelegate.h AppDelegate.m MainViewController.h MainViewController.m MainViewController.xib -
Add all the
MainViewControllerfiles into your Xcode project. -
Copy the
www/phonegap-1.1.0.jsfile from the new project into thewwwdirectory, and delete thewww/phonegap-1.0.0.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newphonegap-1.1.0.jsfile. -
Add a new entry under
Pluginsin thePhoneGap.plistfile. The key iscom.phonegap.batteryand the value isPGBattery. -
Integrate any project-specific code that you have in your backed-up
AppDelegate.handAppDelegate.minto the new AppDelegate files.
Upgrading 0.9.6 Projects to 1.0.0
-
Install Cordova 1.0.0.
-
Make a backup of
AppDelegate.mandAppDelegate.hin your project. -
Create a new project. You will need some of the assets from this new project.
-
Copy these files from the new project into your 0.9.6-based project directory on disk, replacing any old files (backup your files first from step 2 above):
AppDelegate.h AppDelegate.m MainViewController.h MainViewController.m MainViewController.xib -
Add all the
MainViewControllerfiles into your Xcode project. -
Copy the
www/phonegap-1.0.0.jsfile from the new project into thewwwdirectory, and delete thewww/phonegap-0.9.6.jsfile. -
Update the Cordova script reference in the
www/index.htmlfile (and any other files that contain the script reference) to point to the newphonegap-1.0.0.jsfile. -
Add a new entry under
Pluginsin thePhoneGap.plistfile. The key iscom.phonegap.batteryand the value isPGBattery. -
Integrate any project-specific code that you have in your backed-up
AppDelegate.handAppDelegate.minto the new AppDelegate files.