xcode iOS PhoneGap 构建失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17177687/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iOS PhoneGap Build Failure
提问by mav_baumer15
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.
我是PhoneGap
iOS 和 Xcode 的新手。我的应用程序在 Android 手机上运行时遇到了问题。我能够在 iOS 模拟器中构建和运行该应用程序,但是当我将其存档以在设备上进行测试时,出现以下错误。我已经到处搜索,但找不到有效的东西。
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)
回答by skymook
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.
我在 iPhone 4S 上构建Cordova 2.7、Xcode 5 和 iOS7时遇到了类似的错误。我更改了一项设置,它构建正确。
Select your app. Go to Build Settingsthen Valid Architectures. Change to:
选择您的应用。转到Build Settings然后Valid Architectures。改成:
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.
清洁和建造。它似乎与armv7s有关。让它运行的一个副作用是状态栏是透明的并且漂浮在应用程序的顶部。不过,这是另一个主题,与 iOS7 相关。
回答by Clark Burns
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
1) 克隆cordova-ios repo
git clone [email protected]:apache/cordova-ios.git
git 克隆 [email protected]:apache/cordova-ios.git
2) Look at available branches
2)查看可用的分支
git branch -a
git 分支 -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
- 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/设备遥控器/原点/主遥控器/原点/multipart_plugin_result 遥控器/原点/下一个遥控器/原点/phonegap-js
3) I built my app with Cordova 2.9 so checkout the 2.9.x branch -- adjust for your project
3)我使用 Cordova 2.9 构建了我的应用程序,因此请查看 2.9.x 分支——根据您的项目进行调整
git checkout -b 2.9.x origin/2.9.x
git checkout -b 2.9.x origin/2.9.x
4) Verify you are on the desired branch
4) 验证您在所需的分支上
git branch
git 分支
You should see something like:
你应该看到类似的东西:
- 2.9.x master
- 2.9.x 主
5) Go into bin/
5) 进入 bin/
cd bin/
光盘仓/
6) Now recreate the cordova app:
6)现在重新创建cordova应用程序:
./create ~/some/project/dir/project com.project project
./create ~/some/project/dir/project com.project 项目
7) Copy your www folder from the failing build to the new project.
7) 将您的 www 文件夹从失败的构建复制到新项目。
8) Get successful build message from Xcode.
8) 从 Xcode 获取成功构建消息。
9) Give Xcode the finger.
9) 给 Xcode 指点迷津。
Hope this helps!
希望这可以帮助!
回答by albertut
This is an error in Phonegap. You need to go to build settings in the project, search for "Other Linker Flags", then change:
这是Phonegap 中的一个错误。你需要去项目中的构建设置,搜索“Other Linker Flags”,然后更改:
Change "$(TARGET_BUILD_DIR)/libCordova.a"
更改“$(TARGET_BUILD_DIR)/libCordova.a”
to
到
"$(BUILT_PRODUCTS_DIR)/libCordova.a"
"$(BUILT_PRODUCTS_DIR)/libCordova.a"