ios xcode 5.1:libCordova.a 架构问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22334680/
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
xcode 5.1: libCordova.a architecture problems
提问by inorganik
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.
昨天(2014 年 3 月 10 日)发布 iOS 7.1 时,我也升级到 Xcode 5.1,发现我的 PhoneGap/Cordova 项目将不再编译到我的 iPhone 5s。我还将 Cordova 升级到最新版本: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:
我已经阅读了许多关于 SO 的不同解决方案,这些解决方案涉及如此变化的活动架构和仅构建活动架构,但它们都不起作用。所以这是我尝试过的和我得到的错误。最初我得到了错误:
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 Settingsunder Architecturesand made sure that arm64
was not included in any of the Debug or Release architectures. At this time Build Active Architecture Onlyis set to "Yes". That resulted in the following error:
所以我尝试了以下方法。我在我的项目中选择了 CordovaLib 子项目,并且在项目和目标中,我都转到了Architectures下的Build Settings并确保它不包含在任何 Debug 或 Release 架构中。此时Build Active Architecture Only设置为“是”。这导致了以下错误:arm64
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 Onlyto "No", the error again becomes:
将Build Active Architecture Only设置 为“No”,错误再次变为:
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?
我不知道还有什么可以尝试的。该项目的架构设置仅包括设置为 iOS 7.1 的密钥“Base SDK”。项目的目标没有架构设置。无论如何,我相当确定问题出在嵌入式 CordovaLib 子项目上。我该怎么做才能使这个东西成功编译到我的设备上?
Update: same issue on Apache's Jira: https://issues.apache.org/jira/browse/CB-6223
更新:Apache 的 Jira 上的相同问题:https: //issues.apache.org/jira/browse/CB-6223
回答by inorganik
@Shazron posted the fix on the Apache JIRA - he notes that the fix will be released as part of Cordova 3.5:
@Shazron 在 Apache JIRA 上发布了修复程序 - 他指出该修复程序将作为 Cordova 3.5 的一部分发布:
- Select your Project icon
- Choose Build Settings.
- For "Architectures", select $ARCHS_STANDARD - Standard architectures (armv7, armv7s, arm64)
- For "Valid Architectures", add "arm64"
- Select your CordovaLib.xcodeproj icon
- In the Build Settings for the Project (not Target), delete the conditional architecture settings (hover to see the minus sign)
- For "Architectures", select $ARCHS_STANDARD - Standard architectures (armv7, armv7s, arm64)
- For "Valid Architectures", add "arm64"
- Goto 6, but now do it for "Target"
- 选择您的项目图标
- 选择构建设置。
- 对于“架构”,选择 $ARCHS_STANDARD - 标准架构(armv7、armv7s、arm64)
- 对于“有效架构”,添加“arm64”
- 选择您的 CordovaLib.xcodeproj 图标
- 在项目(不是目标)的构建设置中,删除条件架构设置(悬停以查看减号)
- 对于“架构”,选择 $ARCHS_STANDARD - 标准架构(armv7、armv7s、arm64)
- 对于“有效架构”,添加“arm64”
- 转到 6,但现在为“目标”执行此操作
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/
这是 Shazron 对这个问题的完整文章的链接: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“.
Cordova CLI 3.4.1-0.1.0 已经发布,其中包括 Cordova iOS 3.4.1,它包含了这篇博文中提到的所有修复。更新您的 Cordova CLI,如果您有现有项目,请执行“cordova 平台更新 ios”。
回答by Neil Faiman
Another approach that works:
另一种有效的方法:
- Click on your project at the top of the project navigator (not the Cordova.lib subproject).
- In the editor pane, select the project (not the target), select the Build Settings editor tab, and click the All and Levels buttons.
- Expand the Architectures group if necessary and find the Architectures row under it.
- The first (resolved) and third (iOS Default) columns in the Architecture row will say Standard; the second (project) column will be blank.
- Click on the blank second column to bring up a box that will have one line, “$(ARCHS_STANDARD)”.
- Double-click that line to make it editable, then change it to read “$(ARCHS_STANDARD_32_BIT)”.
- Click outside the box to confirm your change. Now the first and second boxes will just have a $ in them.
- Now you should be able to build.
- 单击项目导航器顶部的项目(不是 Cordova.lib 子项目)。
- 在编辑器窗格中,选择项目(而不是目标),选择 Build Settings 编辑器选项卡,然后单击 All 和 Levels 按钮。
- 如有必要,展开 Architectures 组并找到它下面的 Architectures 行。
- 架构行中的第一列(已解决)和第三列(iOS 默认)将显示标准;第二(项目)列将为空白。
- 单击空白的第二列以显示一个包含一行“$(ARCHS_STANDARD)”的框。
- 双击该行使其可编辑,然后将其更改为“$(ARCHS_STANDARD_32_BIT)”。
- 在框外单击以确认您的更改。现在第一个和第二个盒子里只有一个 $ 。
- 现在您应该可以构建了。
回答by AlexLopezIT
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.
将 Xcode 5.1 降级到 5.0.2 对我有用,我迫不及待地等待带有修复程序的官方 Cordova 3.5 版本。
You can get a copy of the previous version here: https://developer.apple.com/downloads/index.action
您可以在此处获取以前版本的副本:https: //developer.apple.com/downloads/index.action
回答by Fabrizio Giordano
They just released a new version 3.4.1that address this issues.
他们刚刚发布了一个新版本3.4.1来解决这个问题。
Therefore I update a single file to point to the TAG 3.4.1:
因此,我更新了一个文件以指向 TAG 3.4.1:
/usr/local/lib/node_modules/cordova/platforms.js
line 24 from:
第 24 行来自:
version: '3.4.0'
to:
到:
version: '3.4.1'
Then you remove the iOS folder in your project and run:
然后删除项目中的 iOS 文件夹并运行:
cordova platform add ios
This will download the new template based on 3.4.1 with all the patches.
这将下载基于 3.4.1 的新模板以及所有补丁。
回答by voyager
Follow the instructions on this video: https://www.youtube.com/watch?v=EIkJAKcz8DE
按照此视频的说明进行操作: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.
只需在您的项目有效架构中添加 arm64 并删除 Cordova 项目的所有条件架构。
回答by Wayferer
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.
通过首先从 XCode 中单独构建 CordovaLib 项目,然后构建我的项目,我能够让我的应用程序在 XCode 5.1 中构建。
回答by Felipe Quirós
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.
您只需要在每个语句和构建设置中添加 arm64 架构,我的意思是,在您当前的项目和cordova 项目中。
On your project:
在您的项目中:
- Architectures
- Valid architectures
- 架构
- 有效架构
on Cordova:
科尔多瓦:
- Architectures
- debug
- release
- Any ios SDK
- 架构
- 调试
- 释放
- 任何 ios SDK
AND THE MOST IMPORTANT
以及最重要的
-Valid architectures at cordova build settings
-cordova 构建设置中的有效架构
This configuration generates a lot of warnings, but is just change the "%d"for "%ld"at all lines that the warning says.
此配置会生成很多警告,但只是在警告所说的所有行中将“%d”更改为“%ld”。
回答by Kevin S
Grab the xcode icon and drag it to the bin!
抓住 xcode 图标并将其拖到垃圾箱中!
Go here https://developer.apple.com/downloads/index.action?name=Xcodeand download 5.0.2 and install.
去这里https://developer.apple.com/downloads/index.action?name=Xcode并下载 5.0.2 并安装。
After installing, run xcode, then try the emulator from terminal.
安装后,运行 xcode,然后从终端尝试模拟器。
Worked for me, annoying though!
为我工作,虽然烦人!