Search code examples
xcodecordovaphonertc

Cordova ignores the specified architecture when building on IOS


I'm trying to build the PhoneRTC demo on IOS after managing to get it to work on Android and web browser (OS X 10.10.2 Yosemite, XCode 6.1.1, Cordova 4.2.0 and my iPad is running iOS 8.1). My iPad is plugged in. I followed the installation steps for IOS:

  1. In General, change Deployment Target to 7.0 or above
  2. Go to Build Settings and change:

    • a. Valid Architectures => armv7
    • b. Build Active Architecture Only => No
    • c. Runpath Search Paths => $(inherited) @executable_path/Frameworks
    • d. Objective-C Bridging Header => [ProjectName]/Plugins/com.dooble.phonertc/Bridging-Header.h
    • e. Embedded content contains Swift Code => yes

I repeated steps 4a. - 4c. for the CordovaLib project as well.

When I run cordova build ios, the build fails. In the console, I see this:

Build settings from command line:
ARCHS = i386
CONFIGURATION_BUILD_DIR = /Users/Francis/Desktop/PhoneRTC/PhoneRTC/platforms/ios/build/emulator
SDKROOT = iphonesimulator8.1
SHARED_PRECOMPS_DIR = /Users/Francis/Desktop/PhoneRTC/PhoneRTC/platforms/ios/build/sharedpch
VALID_ARCHS = i386

This seems to indicate that cordova is ignoring the valid architectures I just specified. I tried rebooting my PC and my iPad also but that didn't help. cordova build ios --archs="armv7" doesn't work either.

Buiding from within XCode works, but that's not what I want since it skips the cordova build process.

Any idea how to tell/force Cordova to build against the architecture (armv7) I specified?


Solution

  • My suggestion is to use cordova prepare and then build from Xcode.

    cordova prepare copies files and config settings but does not modify the native code or try to run the standard build process.

    This is a common build path that I have used with all of my iOS/Cordova projects and seems to work well.