mav_baumer15
mav_baumer15

Reputation: 183

iOS PhoneGap Build Failure

I am new to PhoneGap for iOS and Xcode. I am having an issue with my app that worked on Android phones just fine. I'm able to build and run the app in the iOS simulator but when I archive it to test on devices I get the error below. I've searched all over and cannot find something that works.

Error:

ld: warning: ignoring file /Users/danlehman/Library/Developer/Xcode/DerivedData/HelloWorld-ebkivbdaivqchkgycifnnpgixspn/Build/Intermediates/ArchiveIntermediates/HelloWorld/BuildProductsPath/Release-iphoneos/libCordova.a, file was built for archive which is not the architecture being linked (armv7s): /Users/danlehman/Library/Developer/Xcode/DerivedData/HelloWorld-ebkivbdaivqchkgycifnnpgixspn/Build/Intermediates/ArchiveIntermediates/HelloWorld/BuildProductsPath/Release-iphoneos/libCordova.a
Undefined symbols for architecture armv7s:
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
  "_OBJC_CLASS_$_CDVViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
  "_OBJC_CLASS_$_CDVURLProtocol", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upvotes: 6

Views: 5246

Answers (3)

skymook
skymook

Reputation: 3686

I was getting a similar error for Cordova 2.7, Xcode 5 and iOS7 building on iPhone 4S. I changed one setting, and it built correctly.

Select your app. Go to Build Settings then Valid Architectures. Change to:

armv7

My previous setting was:

arm64 armv7 armv7s

Clean and build. It seems to be related to armv7s. One side effect of getting it running is that the status bar is transparent and floating on top of the app. That is another topic though, and related to iOS7.

Upvotes: 12

albertut
albertut

Reputation: 64

This is an error in Phonegap. You need to go to build settings in the project, search for "Other Linker Flags", then change:

Change "$(TARGET_BUILD_DIR)/libCordova.a"

to

"$(BUILT_PRODUCTS_DIR)/libCordova.a"

Upvotes: 1

Clark Burns
Clark Burns

Reputation: 69

I struggled with this and read through countless "solutions" that seemed to work for some but not me. With that in mind, this might not work for you. :)

1) Clone the cordova-ios repo

git clone [email protected]:apache/cordova-ios.git

2) Look at available branches

git branch -a

You'll probably see something like:

  • master remotes/origin/0.9.5.1 remotes/origin/0.9.6.x remotes/origin/1.6.1 remotes/origin/1091 remotes/origin/2.6.x remotes/origin/2.7.x remotes/origin/2.8.x remotes/origin/2.9.x remotes/origin/3.0.0 remotes/origin/464 remotes/origin/CB-3530 remotes/origin/HEAD -> origin/master remotes/origin/better_resource_copy_step remotes/origin/custom_schemes remotes/origin/device remotes/origin/master remotes/origin/multipart_plugin_result remotes/origin/next remotes/origin/phonegap-js

3) I built my app with Cordova 2.9 so checkout the 2.9.x branch -- adjust for your project

git checkout -b 2.9.x origin/2.9.x

4) Verify you are on the desired branch

git branch

You should see something like:

  • 2.9.x master

5) Go into bin/

cd bin/

6) Now recreate the cordova app:

./create ~/some/project/dir/project com.project project

7) Copy your www folder from the failing build to the new project.

8) Get successful build message from Xcode.

9) Give Xcode the finger.

Hope this helps!

Upvotes: 1

Related Questions