Updating your Cordova project for iOS 9

Devops

Cordova

Just a quick heads up, because many of you may get this kind of problems. We don't often use Xcode UI to build our Corodva applications because we want to automate as much as possible but our Cordova buils have been recently rejected after an update to Xcode 7.

There was a hack in Cordova generated build.xcconfig that required to add:

CODE_SIGN_RESOURCE_RULES_PATH =  $(SDKROOT)/ResourceRules.plist // remove it!  

If Applications Loader is complaining about CFBundleResourceSpecification in Info.plist, you may need to delete it.

Also the application may be complainig about iPad screen orientation for screen split. You should handle it, but a quick fix may include creating a new local plugin and adding the following lines to your plugin.xml.

<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"  
           id="fr.bamlab.iosfix"
      version="1.0.0">
    <name>bamlab-iosfix-plugin</name>
    <description>iOS configuration fix</description>

    <platform name="ios">
      <config-file target="*-Info.plist" parent="UIRequiresFullScreen">
          <true/> 
      </config-file>
    </platform>
</plugin>  

This forces the application to be used in fullscreen mode only.

Last, but not least, most of your frameworks won't be compiled for BITCODE, which a cordova build will enable by default, so you should add the following line to build.xcconfig:

ENABLE_BITCODE = NO  

It will disable bitcode for your project.

UPDATE:

If your application stops communicating with the API, this may mean that you are being blocked by the new App Transport Security policy which requires https connections. You can check that in debug console - you should see something like "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection". Your best options is obviously enabling https, but you can disable it temporarily by adding the following code to plugin.xml

<config-file target="*-Info.plist" parent="NSAppTransportSecurity">  
    <dict>
      <key>NSExceptionDomains</key>
      <dict>
        <key>yourserver.com</key>
        <dict>
          <!--Include to allow subdomains-->
          <key>NSIncludesSubdomains</key>
          <true/>
          <!--Include to allow HTTP requests-->
          <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
          <true/>
        </dict>
      </dict>
    </dict>
</config-file>  

And if you are using Ionic, don't forget to include the Angular fix for iOS 9.

Of course you can also do all of this in your Xcode by selecting the relevant options.

Hope it saves you few minutes of searching!