bar*_*ney 69 cpu-architecture static-libraries cordova ios7 xcode5
我刚刚将我的iPhone 4S软件更新到iOS 7 Beta 2,而我正在最后接触到一个新的应用程序(Phonegap)..不是一个好主意!
完成后,Xcode没有检测到我的iPhone,所以我安装了Xcode 5 beta.在摆弄它之后我终于得到它来检测我的手机.现在唯一的问题是使用的架构存在错误.
以下是产生的错误:
ld: warning: ignoring file /Users/-----------/Library/Developer/Xcode/DerivedData/testtest-bmnbmujiosugcmgeiceofgcfmsec/Build/Products/Debug-iphoneos/libCordova.a, file was built for archive which is not the architecture being linked (armv7s): /Users/--------/Library/Developer/Xcode/DerivedData/testtest-bmnbmujiosugcmgeiceofgcfmsec/Build/Products/Debug-iphoneos/libCordova.a
Undefined symbols for architecture armv7s:
"_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
_OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
"_CDVLocalNotification", referenced from:
-[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
"_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
_OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
"_OBJC_CLASS_$_CDVCommandQueue", referenced from:
_OBJC_CLASS_$_MainCommandQueue in MainViewController.o
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
"_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
_OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
"_CDVPluginHandleOpenURLNotification", referenced from:
-[AppDelegate application:handleOpenURL:] in AppDelegate.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
_OBJC_CLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
有关架构应该改变的任何想法,以使其在我的手机上工作?(它在模拟器上工作正常)
Taf*_*soh 104
简短回答:

详细解答:
问题是您在主应用程序中链接的静态库'libCordova.a'仅针对一个体系结构(armv7,但不是armv7)进行编译.
您可能已经让Xcode对静态库项目执行了所有建议的更改,而没有阅读这些更改实际上是什么.说到我自己,我从来没有费心仔细看看那个信息对话框(下面的截图),当我切换到新版本的Xcode时 - 直到现在.

问题是执行这些更改会激活调试构建一个名为Build Active Architecture Only的新功能(构建设置参数键为'ONLY_ACTIVE_ARCH').原则上,这是Xcode的一个非常酷的增强,因为将其设置为YES会导致更快的构建时间,因为当您点击运行按钮时,Xcode仅编译您当前在顶部选择的连接设备的体系结构.
但是,当在静态库中盲目接受这个新参数时,您可能会遇到此错误.当您在连接armv7设备时构建静态库的调试版本时会发生错误,然后,当您调试主应用程序时,您已连接armv7s设备(反之亦然).随后你会得到上面的错误(或类似的错误).
因此,我的建议是从所有静态库的项目构建设置中完全删除" 仅构建活动体系结构"的项目级别的值.因为如果你看一下iOS的默认值,那就是NO.当然,您也可以将设置覆盖为"否",以确保设置正确,即使将来默认值会改变(参见第1个屏幕截图).
njt*_*man 75
如果您的项目是使用Cordova 2.x和Xcode 4.x构建的,并且您收到了OP提到的错误,那么这个解决方案对我有用.(我遇到了Cordova 2.5和Xcode 5的错误).
https://issues.apache.org/jira/browse/CB-3768
转到您的Cordova项目
根文件夹 - > CordovaLib - >右键单击CordovaLib.xcodeproj - >显示包内容 - >打开project.pbxproj
替换所有出现的(我有4个)
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;//in 2 out of 4 occurrences
"ARCHS[sdk=iphoneos*]" = armv7;
"ARCHS[sdk=iphoneos6.*]" = (
armv7,
armv7s,
);
/* other settings here */
};
Run Code Online (Sandbox Code Playgroud)
有了这个
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;//in 2 out of 4 occurrences
"ARCHS[sdk=iphoneos*]" = armv7;
"ARCHS[sdk=iphoneos7.*]" = (
armv7,
armv7s,
);
"ARCHS[sdk=iphoneos6.*]" = (
armv7,
armv7s,
);
/* other settings here */
};
Run Code Online (Sandbox Code Playgroud)
现在您的项目将构建良好!
Har*_*nan 13
我已经删除armv7s了valid architectures部分,它对我有用.
构建设置 - >体系结构 - >有效的体系结构

Mal*_*loc 11
我正在使用Xcode 5,因此iOS SDK 7.对我有用的解决方案就是删除arm64架构.
选择项目目标(不是CordovaLib.xcodeproj),然后在构建设置>有效体系结构中,删除arm64(如果它在列表中).删除arm64架构后,这是我的.

| 归档时间: |
|
| 查看次数: |
59935 次 |
| 最近记录: |