当我打开我在Xcode 4中创build的Google Maps项目时,Xcode 5会警告我的架构设置

我刚刚更新到新发布的Xcode 5.我有一个iOS应用程序正在开发中,使用Google Maps iOS SDK。 当我在Xcode 4中开发时,我改变了我的项目设置中的Architectures设置,按照Google 关于将SDK添加到项目中的步骤7:

7.select您的项目,而不是特定的目标,然后打开“生成设置”选项卡。 用armv7replace架构的默认值。 在Other Linker Flags部分中,添加-ObjC。 如果这些设置不可见,请将“生成设置”栏中的filter从“基本”更改为“全部”。

在Xcode 4中一切正常。但是,当我在Xcode 5中打开项目时,在问题导航器中看到以下警告:

validation项目设置

更新为推荐设置

当我点击警告,Xcode带我到我的项目设置,并显示一个popup与“取消”和“执行更改”button,以下描述的变化,它想使

项目“你的项目” – 自动select体系结构

项目“您的项目”覆盖“体系结构”设置。 这将删除设置,并允许Xcode基于可用于活动平台和部署目标的硬件自动select体系结构。

我试着点击“执行变更”,让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和摆脱这个警告,同时仍然允许我的应用程序成功构buildiPhone 5?

Google Maps SDK v1.5现在支持ARMv7S。 从v1.5 发行说明 :

iOS的Google Maps SDK现在随附一个armv7s切片。 (问题4745)

在您的应用中支持ARMv7S可以提高性能,所以如果您看到问题中所述的警告,最好采取的行动是将您的Google Maps SDK版本更新到v1.5(或更高版本,如果您正在阅读将来),然后双击该警告,并允许Xcode将您的架构设置更改回默认值。

糟糕 – 正如它发生的事情,发布这个问题后,我只需要几秒钟的实验自己find答案:

  1. 在Issue Navigator中单击“validation项目设置”警告。
  2. 取消选中“自动select架构”build议更改左侧的checkbox。
  3. 点击“完成”(或“执行更改”,如果列表中还有其他更改,实际上是想要做的 – 在我的情况下,这是唯一的)。

现在你的设置和以前一样了,你可以为iPhone 5创build,但是警告已经消失了。

我现在感觉有点朦胧,因为我花了我的时间来发表这个问题,但我留下的问题和这个答案在这里,以防万一以后帮助任何人。

链接器给你一个错误,因为你正在使用的GoogleMaps框架不支持armv7s架构。 也许最新版本的GoogleMaps框架有这样的支持,或者您需要等待Google的更新。