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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18898999/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:49:55  来源:igfitidea点击:

Xcode 5 warns about my architectures setting when I open my Google Maps project created in Xcode 4

iosxcodelinkercpu-architecturegoogle-maps-sdk-ios

提问by Mark Amery

I just updated to the newly released Xcode 5. I have an iOS app under development that uses the Google Maps iOS SDK. Back when I was developing in Xcode 4, I changed my Architecturessetting in my project settings, as per step 7 of Google's instructions for adding the SDK to the project:

我刚刚更新到新发布的 Xcode 5。我正在开发一个使用 Google Maps iOS SDK 的 iOS 应用程序。回到我在 Xcode 4 中进行开发时,我Architectures根据 Google将 SDK 添加到项目说明的第 7 步更改了项目设置中的设置:

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.

7. 选择您的项目,而不是特定目标,然后打开 Build Settings 选项卡。用 armv7 替换 Architectures 的默认值。在其他链接器标志部分,添加 -ObjC。如果这些设置不可见,请将“构建设置”栏中的过滤器从“基本”更改为“全部”。

Everything was fine in Xcode 4. However, when I open my project in Xcode 5, I see the following warning in the issue navigator:

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

Validate Project Settings

Update to recommended settings

验证项目设置

更新到推荐设置

When I click the warning, Xcode takes me to my project settings and displays a popup with 'Cancel' and 'Perform Changes' buttons, and the following description of the change it wants to make

当我点击警告时,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 根据活动平台和部署目标可用的硬件自动选择架构。

I tried clicking 'Perform Changes' and letting Xcode do whatever it wanted to do, and the app still built fine for the simulators. However, when I tried plugging in an iPhone 5 (which supports ARMv7S) and running on it, the app failed to build with the following linker error:

我尝试单击“执行更改”并让 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)

Once I reverted the automatic changes Xcode had made, my app compiled fine for iPhone 5 again - but of course I had the warning back.

一旦我恢复了 Xcode 所做的自动更改,我的应用程序再次为 iPhone 5 编译得很好 - 但当然我收到了警告。

How can I satisfy Xcode and get rid of the warning while still allowing my app to build successfully for iPhone 5?

我怎样才能满足 Xcode 并消除警告,同时仍然允许我的应用程序为 iPhone 5 成功构建?

回答by Mark Amery

Oops - as it happened it only took me a few seconds of experimentation after posting this question to find the answer myself:

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

  1. Click the 'Validate Project Settings' warning in the Issue Navigator.
  2. Uncheck the checkbox to the left of the 'Automatically Select Architectures' suggested change.
  3. Click 'Done' (or 'Perform Changes' if there are other changes left on the list that you actually want to make - in my case, this was the only one).
  1. 单击问题导航器中的“验证项目设置”警告。
  2. 取消选中“自动选择架构”建议更改左侧的复选框。
  3. 单击“完成”(或“执行更改”,如果列表中还有其他您真正想要进行的更改 - 在我的情况下,这是唯一的更改)。

Now your settings are as they were before, and you can build for iPhone 5, but the warning is gone.

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

I feel a bit dim now for having spent my time posting this question, but I'm leaving the question and this answer here in case it helps anyone in the future.

我现在感觉有点昏暗,因为我花了很多时间发布这个问题,但我把这个问题和这个答案留在这里,以防它对未来的任何人有所帮助。

回答by Jenn

Google Maps SDK v1.5 now supports ARMv7S. From the v1.5 release notes:

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

The Google Maps SDK for iOS now ships with an armv7s slice. (Issue 4745)

iOS 版 Google Maps SDK 现在附带 armv7s 切片。(第 4745 期)

Supporting ARMv7S in your app will improve performance, so the best course of action to take if you see the warning described in the question is to update your version of the Google Maps SDK to v1.5 (or later, if you are reading this in the future) and then double-click the warning and allow Xcode to change your architecture settings back to the default.

在您的应用程序中支持 ARMv7S 将提高性能,因此如果您看到问题中描述的警告,最好采取的措施是将您的 Google Maps SDK 版本更新到 v1.5(或更高版本,如果您在未来),然后双击警告并允许 Xcode 将您的架构设置更改回默认值。

回答by Jonathan Arbogast

The linker is giving you an error because the GoogleMaps frameworkthat you are using doesn't support the armv7s architecture. Maybe the latest version of the GoogleMaps framework has such support or maybe you'll have to wait for an update from Google.

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