我刚刚更新到新发布的 Xcode 5。我正在开发一个使用 Google 地图 iOS SDK 的 iOS 应用程序。当我在 Xcode 4 中开发时,我改变了我的Architectures
在我的项目设置中进行设置,按照 Google 的步骤 7将SDK添加到项目中的说明 https://developers.google.com/maps/documentation/ios/start:
7. 选择您的项目,而不是特定目标,然后打开“构建设置”选项卡。
将Architectures的默认值替换为armv7。
在“其他链接器标志”部分中,添加 -ObjC。如果这些设置不可见,请将“构建设置”栏中的过滤器从“基本”更改为“全部”。
Xcode 4 中一切正常。但是,当我在 Xcode 5 中打开项目时,我在问题导航器中看到以下警告:
验证项目设置
更新为推荐设置
当我单击警告时,Xcode 将我带到我的项目设置并显示一个带有“取消”和“执行更改”按钮的弹出窗口,以及它想要进行的更改的以下描述
项目“您的项目” - 自动选择架构
项目“您的项目”会覆盖架构设置。这将删除设置并允许 Xcode 根据活动平台和部署目标可用的硬件自动选择架构。
我尝试单击“执行更改”并让 Xcode 执行它想做的任何操作,并且该应用程序仍然可以为模拟器构建良好的效果。但是,当我尝试插入 iPhone 5(支持 ARMv7S)并在其上运行时,该应用程序无法构建,并出现以下链接器错误:
Ld /Users/macmini/Library/Developer/Xcode/DerivedData/Your_App-bmrouudjlblpafdjzhpwcuekzgwu/Build/Products/Debug-iphoneos/Your\ App.app/Your\ App normal armv7s
cd "/Users/macmini/Documents/Your App"
setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/macmini/Library/Developer/Xcode/DerivedData/Your_App-bmrouudjlblpafdjzhpwcuekzgwu/Build/Products/Debug-iphoneos -F/Users/macmini/Library/Developer/Xcode/DerivedData/Your_App-bmrouudjlblpafdjzhpwcuekzgwu/Build/Products/Debug-iphoneos -F/Users/macmini/Documents/Your\ App -filelist /Users/macmini/Library/Developer/Xcode/DerivedData/Your_App-bmrouudjlblpafdjzhpwcuekzgwu/Build/Intermediates/Your\ App.build/Debug-iphoneos/Your\ App.build/Objects-normal/armv7s/Your\ App.LinkFileList -dead_strip -ObjC -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.1 -framework SystemConfiguration -framework MapKit -framework QuartzCore -framework OpenGLES -lz -licucore -lc++ -framework ImageIO -framework GLKit -framework CoreText -framework CoreLocation -framework AVFoundation -framework CoreData -framework UIKit -framework Foundation -framework CoreGraphics -framework GoogleMaps -Xlinker -dependency_info -Xlinker /Users/macmini/Library/Developer/Xcode/DerivedData/Your_App-bmrouudjlblpafdjzhpwcuekzgwu/Build/Intermediates/Your\ App.build/Debug-iphoneos/Your\ App.build/Objects-normal/armv7s/Your\ App_dependency_info.dat -o /Users/macmini/Library/Developer/Xcode/DerivedData/Your_App-bmrouudjlblpafdjzhpwcuekzgwu/Build/Products/Debug-iphoneos/Your\ App.app/Your\ App
ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Users/macmini/Documents/Your App/GoogleMaps.framework/GoogleMaps file '/Users/macmini/Documents/Your App/GoogleMaps.framework/GoogleMaps' for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
当我恢复 Xcode 所做的自动更改后,我的应用程序再次针对 iPhone 5 编译得很好 - 但当然我又收到了警告。
如何满足 Xcode 的要求并消除警告,同时仍允许我的应用程序为 iPhone 5 成功构建?
哎呀 - 事实上,在发布这个问题后,我只花了几秒钟的实验时间就找到了答案:
- 单击问题导航器中的“验证项目设置”警告。
- 取消选中“自动选择架构”建议更改左侧的复选框。
- 单击“完成”(如果列表中还有您实际想要进行的其他更改,则单击“执行更改” - 就我而言,这是唯一的更改)。
现在您的设置与以前一样,您可以为 iPhone 5 进行构建,但警告消失了。
我现在因为花时间发布这个问题而感到有点昏暗,但我将问题和这个答案留在这里,以防它对将来的任何人有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)