Downgrading the PhoneGap Library Used by the iOS Hybrid Web Container

Change from the Cordova 2.0 library included with the iOS Hybrid Web Container to the PhoneGap 1.4.1 library.

  1. Unzip PhoneGapLib.zip.
    This unzips to a directory named PhoneGapLib.
  2. Copy PhoneGapLib inside the HybridWebContainer directory, which is located in \SUP_HOMEUnwiredPlatform\MobileSDKversion\HybridApp\Containers\iOS\.
  3. In Xcode, in the HybridWebContainer directory, open the HWC.xcodeproj.
  4. Under the Resources group folder, remove VERSION, Capture.bundle, www, and Cordova.plist, and replace them with equivalent files, from HybridWebContainer/PhoneGapLib.
    Note: The Cordova.plist file will be replaced by the PhoneGap.plist file.
  5. (Optional) Delete the HybridWebContainer/CordovaLib directory and libCordova.a in each of the HybridWebContainer/libs/<configuration> directories.
  6. Open the PhoneGapLib.xcodeproj, which is located in HybridWebContainer/PhoneGapLib.
  7. Build all four configurations of the PhoneGapLib target, including Release-iphoneos, Debug-iphoneos, Release-iphonesimulator, and Debug-iphonesimulator.
  8. Copy the libPhoneGap.a file from each configuraton build directory to the corresponding directory in HybridWebContainer/libs/<configuration>.
  9. Close the PhoneGapLib Xcode project.
  10. Go back to HWC.xcodeproj, open the project settings, and go to the Build Settings tab.
    1. Under Other Linker Flags, change all instances of "libCordova.a" to "libPhoneGap.a."
    2. Under Header Search Paths, change all instances of "CordovaLib" to "PhoneGapLib."
  11. Perform two global search-and-replace operations in Xcode and replace:
    • USE_CORDOVA with USE_PHONEGAP
    • CORDOVA_FRAMEWORK with PHONEGAP_FRAMEWORK
  12. Open the HWCAppDelegate.h file, which is in the Classes group folder.
    1. In the #ifdef USE_PHONEGAP block at the top of the file, change the import statements so they are importing PhoneGapDelegate.h instead of CDVViewController.h.
      The code should look like this:
      #ifdef USE_PHONEGAP
      #ifdef PHONEGAP_FRAMEWORK
      #import <PhoneGap/PhoneGapDelegate.h>
      #else
      #import "PhoneGapDelegate.h"
      #endif
    2. In the interface definition for HWCAppDelegate, change the superclass in the #ifdef USE_PHONEGAP block from CDVViewController to PhoneGapDelegate.
  13. Open the HWCAppDelegate.m file, which is located in the Classes group folder, and in each of the following functions, add the specified code at the end of the function, just before it returns.
    1. Just before the function application:didFinishLaunchingWithOptions: returns, add:
      #ifdef USE_PHONEGAP
         
      if ( [super respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)])
            
      [super application:[UIApplication sharedApplication] didFinishLaunchingWithOptions:launchOptions]; 
      
      #endif
    2. Just before the function applicationDidBecomeActive: returns, add:
      #ifdef USE_PHONEGAP
         
      if ( [super respondsToSelector:@selector(applicationDidBecomeActive:)])
            
      [super applicationDidBecomeActive:application]; 
      
      #endif
    3. Just before the function applicationWillResignActive: returns, add:
      #ifdef USE_PHONEGAP
         
      if ( [super respondsToSelector:@selector(applicationWillResignActive:)])
            
      [super applicationWillResignActive:application]; 
      
      #endif
    4. Just before the function applicationWillTerminate: returns, add:
      #ifdef USE_PHONEGAP
         
      if ( [super respondsToSelector:@selector(applicationWillTerminate:)])
            
      [super applicationWillTerminate:application];
      
      #endif
      
  14. In the applicationWillEnterForeground: function, change the call to the superclass method onAppWillEnterForeGround: to a call to the superclass method applicationWillEnterForeground:.
    if ( [super respondsToSelector:@selector(applicationWillEnterForeground:)])
       
    [super applicationWillEnterForeground:application];
  15. In the applicationDidEnterBackground: function, change the call to the superclass method onAppDidEnterBackGround: to a call to the superclass method applicationDidEnterBackground:.
    if ( [super respondsToSelector:@selector(applicationDidEnterBackground:)])
       
    [super applicationDidEnterBackground:application];
    
  16. Save the file.
  17. Rebuild the HWC.xcodeproj project.
    1. From the Xcode menu, select Product > Clean.
    2. Select Product > Build.