81

Yesterday (3/10/14) when iOS 7.1 was released I also upgraded to Xcode 5.1 and found that my PhoneGap/Cordova project would no longer compile to my iPhone 5s. I also upgraded Cordova to the most recent release: v 3.4.0-0.1.3.

I have read many different solutions on SO that relate so changing active architectures and building only active architectures, and none of them work. So here's what I've tried and the errors I get. Initially I got the error:

missing required architecture arm64 in file <long file path omitted> libCordova.a
Undefined symbols for architecture arm64

So I tried the following. I selected the CordovaLib sub-project in my project, and in both the project and target, I went to Build Settings under Architectures and made sure that arm64 was not included in any of the Debug or Release architectures. At this time Build Active Architecture Only is set to "Yes". That resulted in the following error:

file was built for archive which is not the architecture being linked (armv7): 
<long file path omitted> libCordova.a
Undefined symbols for architecture armv7

Setting Build Active Architecture Only to "No", the error again becomes:

missing required architecture arm64 in file <long file path omitted> libCordova.a
Undefined symbols for architecture arm64

I'm not sure what else to try. The project's architecture settings only includes the key "Base SDK" which is set to iOS 7.1. The project's target does not have architectures settings. Anyway I'm fairly certain the problem lies with the embedded CordovaLib sub-project. What can I do to make this thing compile to my device successfully?

Update: same issue on Apache's Jira: https://issues.apache.org/jira/browse/CB-6223

inorganik
  • 24,255
  • 17
  • 90
  • 114
  • 2
    I have exactly the same problem. iOS 7.1 and Xcode 5.1 have been available to developers for some time, so it's disappointing that the Cordova team didn't at least issue a warning about this before they were released. – Ade Mar 11 '14 at 19:47
  • Yea. I created a brand new 'Hello World' Cordova Project with the most recent Cordova installed and it wouldn't compile successfully. – inorganik Mar 11 '14 at 19:49
  • Is it possible to get hold of and reinstall the iOS 7.0 SDK ? – Ade Mar 11 '14 at 19:56
  • I got it to compile using [these settings](https://dl.dropboxusercontent.com/u/618674/_perma/2014-03/xcode.png) but when I go to Validate the archive I get the error: **This bundle is invalid. Apps that include an armv7s architecture are required to include an armv7 architecture. Which is weird because it looks like I _have_ included both. – Ade Mar 11 '14 at 19:59
  • Yes, you can do it in iTunes with your phone connected to your Mac. But you won't be able to release your app because it won't run on iOS 7.1... – inorganik Mar 11 '14 at 19:59
  • I have managed to compile and validate my existing app with just the 'armv7' architecture selected in both the Project and Target. I'm not sure what the implications are of not including armv7s and arm64. Will it not run on an iPhone 5S ? – Ade Mar 11 '14 at 20:16
  • Nope, I don't believe they will compile to a 5s without `armv7s`. – inorganik Mar 11 '14 at 20:26
  • 3
    Fix steps in the Apache Cordova JIRA issue: https://issues.apache.org/jira/browse/CB-6223. – Shazron Mar 11 '14 at 20:54

8 Answers8

86

@Shazron posted the fix on the Apache JIRA - he notes that the fix will be released as part of Cordova 3.5:

  1. Select your Project icon
  2. Choose Build Settings.
  3. For "Architectures", select $ARCHS_STANDARD - Standard architectures (armv7, armv7s, arm64)
  4. For "Valid Architectures", add "arm64"
  5. Select your CordovaLib.xcodeproj icon
  6. In the Build Settings for the Project (not Target), delete the conditional architecture settings (hover to see the minus sign)
  7. For "Architectures", select $ARCHS_STANDARD - Standard architectures (armv7, armv7s, arm64)
  8. For "Valid Architectures", add "arm64"
  9. Goto 6, but now do it for "Target"

Here's a link to Shazron's complete writeup of this problem: http://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/

It is now released and the short version of what to do is:

Cordova CLI 3.4.1-0.1.0 is out, which includes Cordova iOS 3.4.1 which incorporates all the fixes mentioned in this blog post. Update your Cordova CLI, and if you have an existing project, do a “cordova platform update ios“.

Leo
  • 1,495
  • 23
  • 41
inorganik
  • 24,255
  • 17
  • 90
  • 114
  • 10
    Excellent. For step #6 am I correct in thinking I should delete ALL of these: [SCREENSHOT](https://dl.dropboxusercontent.com/u/618674/_perma/2014-03/contitional-architectures.png) ? – Ade Mar 11 '14 at 21:27
  • 1
    It _seems ok_ at first: The app archives, and validates. But when exported as an ad hoc distribution it will not run on an iPhone 5S. – Ade Mar 11 '14 at 22:30
  • 7
    Yes, this answer gets the app to compile and install on a 5S, but when it starts to run it throws an lldb error and crashes (or pauses if you're running your device tethered to your Mac while running Xcode). – Jough Dempsey Mar 12 '14 at 03:00
  • 5
    Here is the link to @Shazron post. It covers 3 issues: http://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/ – stefbach Mar 12 '14 at 10:38
  • I confirm it works for me. Do not forget point 9 which is to remove any conditional architecture settings for target 'Cordova Lib'. You should have for both Project 'CordovaLib' and targets 'CordovaLib'. Architecture settings should looks : - Debug : Standard architecture (...) - Release : Standard architecture (...) – stefbach Mar 12 '14 at 10:40
  • By removing all of the conditional architectures, while it allowed me to compile the app, it broke some of my plugins. I am now getting "not found, or is not a CDVPlugin" errors. Be careful and make a backup of your project. – njtman Mar 12 '14 at 17:36
  • I've found this solution works great provided you don't validate (it undoes your changes)... @njtman what plugins don't work? I have a ton of plugins that are working just fine. – inorganik Mar 12 '14 at 18:20
  • @inorganik they are specific cordova plugins compiled for enterprise that are not generally available to the public. they will need to re-compile them to work with arm64 I suppose. In the mean time I downgraded Xcode and all is good. – njtman Mar 12 '14 at 18:29
  • I was on a previous version of Cordova (3.3.0) which required some additional steps I posted here along with some pics for what @stechbach points out: http://wp.me/pxvmV-6x. Thanks for this! – occasl Mar 14 '14 at 19:23
  • Excellent. I was confused with 15 strange errors, and now they're gone :). Thanks. – Tien Do Apr 01 '14 at 02:38
  • This solution worked well for me once I'd also changed all instances of Build Active Architecture Only to No. – flyingace Apr 25 '14 at 02:24
  • Just had to do this for iOS 8 and XCode 6. It force an update to 5.1.1 for OS deployment minimum target but that is OK by me. – Guy Lowe Sep 15 '14 at 06:18
11

Another approach that works:

  1. Click on your project at the top of the project navigator (not the Cordova.lib subproject).
  2. In the editor pane, select the project (not the target), select the Build Settings editor tab, and click the All and Levels buttons.
  3. Expand the Architectures group if necessary and find the Architectures row under it.
  4. The first (resolved) and third (iOS Default) columns in the Architecture row will say Standard; the second (project) column will be blank.
  5. Click on the blank second column to bring up a box that will have one line, “$(ARCHS_STANDARD)”.
  6. Double-click that line to make it editable, then change it to read “$(ARCHS_STANDARD_32_BIT)”.
  7. Click outside the box to confirm your change. Now the first and second boxes will just have a $ in them.
  8. Now you should be able to build.
Neil Faiman
  • 111
  • 3
10

Downgrade Xcode 5.1 to 5.0.2 worked for me, I could not wait for an official Cordova 3.5 release with the fix.

You can get a copy of the previous version here: https://developer.apple.com/downloads/index.action

AlexLopezIT
  • 141
  • 5
  • 3
    This works - the only caveat being that you can't test directly in XCode on an iPhone that is running iOS 7.1. This is where the simulator comes in handy. The compiled app _can_ run on iOS 7.1 (confirmed on both an iPhone 5 and 5S) so downgrading till Cordova 3.5 is released seems the best option. – Ade Mar 12 '14 at 10:50
  • This works for me best right now too. Downloaded Xcode 5.02 and copied it (naming it XCode_502 first) to Applications enabled me to run it next to Xcode 5.1. – EeKay Mar 12 '14 at 14:16
  • Ade I have downgraded to 5.0.2 and have been testing my app on iPhone 5 and iPad 2 both with iOS 7.1, with no problems, I have also submitted the app to iTunes Connect with no problems. – AlexLopezIT Mar 13 '14 at 02:18
8

They just released a new version 3.4.1 that address this issues.

Therefore I update a single file to point to the TAG 3.4.1:

/usr/local/lib/node_modules/cordova/platforms.js

line 24 from:

version: '3.4.0'

to:

version: '3.4.1'

Then you remove the iOS folder in your project and run:

cordova platform add ios

This will download the new template based on 3.4.1 with all the patches.

Fabrizio Giordano
  • 2,941
  • 4
  • 20
  • 16
5

Follow the instructions on this video: https://www.youtube.com/watch?v=EIkJAKcz8DE

Just add arm64 in your projects valid architectures and remove all the conditional architecture of Cordova's project.

voyager
  • 85
  • 5
3

I was able to get my app to build in XCode 5.1 by first building the CordovaLib project separately from within XCode and then building my project.

Wayferer
  • 109
  • 2
  • 12
  • This worked for me as well. Perfect, since downgrading Xcode (and not being able to test on iOS7.1 devices) is not an option for me. Thanks! – Adam Tuttle Mar 28 '14 at 16:21
2

You just have to add the arm64 architecture on every statement and building setting, i mean, on your current project, and on the cordova project.

On your project:

  • Architectures
  • Valid architectures

on Cordova:

  • Architectures
  • debug
  • release
  • Any ios SDK

AND THE MOST IMPORTANT

-Valid architectures at cordova build settings

This configuration generates a lot of warnings, but is just change the "%d" for "%ld" at all lines that the warning says.

Felipe Quirós
  • 430
  • 5
  • 15
1

Grab the xcode icon and drag it to the bin!

Go here https://developer.apple.com/downloads/index.action?name=Xcode and download 5.0.2 and install.

After installing, run xcode, then try the emulator from terminal.

Worked for me, annoying though!

Kevin S
  • 1,067
  • 1
  • 10
  • 19