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

标签 ios xcode linker cpu-architecture google-maps-sdk-ios

我刚刚更新到新发布的 Xcode 5。我正在开发一个使用 Google Maps iOS SDK 的 iOS 应用程序。回到我在 Xcode 4 中开发时,我根据 Google 的 instructions for adding the SDK to the project 的第 7 步更改了项目设置中的 Architectures 设置。 :

7. Choose your project, rather than a specific target, and open the Build Settings tab. Replace the default value of Architectures with armv7. In the Other Linker Flags section, add -ObjC. If these settings are not visible, change the filter in the Build Settings bar from Basic to All.

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

Validate Project Settings

Update to recommended settings

当我单击警告时,Xcode 将我带到我的项目设置并显示一个带有“取消”和“执行更改”按钮的弹出窗口,以及它想要进行的更改的以下描述

Project 'Your Project' - Automatically Select Architectures

Project 'Your Project' overrides the Architectures setting. This will remove the settings and allow Xcode to automatically select Architectures based on hardware available for the active platform and deployment target.

我尝试单击“执行更改”并让 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 成功构建?

最佳答案

糟糕 - 碰巧的是,在发布这个问题后我只花了几秒钟的实验就自己找到了答案:

  1. 点击问题导航器中的“验证项目设置”警告。
  2. 取消选中“自动选择架构”建议更改左侧的复选框。
  3. 单击“完成”(如果列表中还有其他您实际想要进行的更改,则单击“执行更改”——在我的例子中,这是唯一的更改)。

现在您的设置和以前一样,您可以为 iPhone 5 构建,但警告消失了。

我现在对花时间发布这个问题感到有点茫然,但我将问题和这个答案留在这里,以防将来对任何人有所帮助。

关于ios - 当我打开在 Xcode 4 中创建的 Google Maps 项目时,Xcode 5 会警告我的架构设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18898999/

相关文章:

c++ - LLD - 未知参数 : -arch

ios - 使用 KIF 点击状态栏或以编程方式进行

ios - 找不到自定义模块

cocoa - 主菜单栏中的菜单项以不同的字体大小显示。什么给出了?

c++ - 从我的程序连接到 mysql Web 数据库

c++ - 在 C++ 中声明方法 extern

c++ - 虚拟方法会使应用程序变慢,但它们可以加快链接速度吗?

ios - 触摸时未检测到自定义 SKSpriteNode

ios - 更多选项卡 View Controller 选择器及其各自的 View Controller 顶部的白色栏

ios - 带有核心数据的预加载数据库