xcode 如何解决我希望提交到应用商店的 iOS 项目中的错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19520683/
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
How can I address errors in my iOS project which I hope to submit to app store?
提问by Christos Hayward
When I tried to build an archive for an app I am trying to submit (my first submission), I got a bunch of errors, mostly about import errors related to Darwin:
当我尝试为要提交的应用程序(我的第一次提交)构建存档时,我遇到了一堆错误,主要是与 Darwin 相关的导入错误:
ProcessPCH /Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/PrecompiledHeaders/Steampunk\ Clock-Prefix-gxthjnzoqzlexccyjihvntdifuwt/Steampunk\ Clock-Prefix.pch.pch Steampunk\ Clock/Steampunk\ Clock-Prefix.pch normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler cd "/Users/jonathan/Desktop/Steampunk Clock" setenv LANG en_US.US-ASCII 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 -x objective-c-header -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/jonathan/Library/Developer/Xcode/DerivedData/ModuleCache -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DNS_BLOCK_ASSERTIONS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion -miphoneos-version-min=5.0 -iquote /Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/IntermediateBuildFilesPath/Steampunk\ Clock.build/Release-iphoneos/Steampunk\ Clock.build/Ancient\ Steampunk\ Clock-generated-files.hmap -I/Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/IntermediateBuildFilesPath/Steampunk\ Clock.build/Release-iphoneos/Steampunk\ Clock.build/Ancient\ Steampunk\ Clock-own-target-headers.hmap -I/Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/IntermediateBuildFilesPath/Steampunk\ Clock.build/Release-iphoneos/Steampunk\ Clock.build/Ancient\ Steampunk\ Clock-all-target-headers.hmap -iquote /Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/IntermediateBuildFilesPath/Steampunk\ Clock.build/Release-iphoneos/Steampunk\ Clock.build/Ancient\ Steampunk\ Clock-project-headers.hmap -I/Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/BuildProductsPath/Release-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/IntermediateBuildFilesPath/Steampunk\ Clock.build/Release-iphoneos/Steampunk\ Clock.build/DerivedSources/arm64 -I/Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/IntermediateBuildFilesPath/Steampunk\ Clock.build/Release-iphoneos/Steampunk\ Clock.build/DerivedSources -F/Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/BuildProductsPath/Release-iphoneos --serialize-diagnostics /Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/PrecompiledHeaders/Steampunk\ Clock-Prefix-gxthjnzoqzlexccyjihvntdifuwt/Steampunk\ Clock-Prefix.pch.dia -MMD -MT dependencies -MF /Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/PrecompiledHeaders/Steampunk\ Clock-Prefix-gxthjnzoqzlexccyjihvntdifuwt/Steampunk\ Clock-Prefix.pch.d -c /Users/jonathan/Desktop/Steampunk\ Clock/Steampunk\ Clock/Steampunk\ Clock-Prefix.pch -o /Users/jonathan/Library/Developer/Xcode/DerivedData/Steampunk_Clock-cblavmmgjxgqzpfwzbpirbdjpspm/Build/Intermediates/ArchiveIntermediates/Steampunk\ Clock/PrecompiledHeaders/Steampunk\ Clock-Prefix-gxthjnzoqzlexccyjihvntdifuwt/Steampunk\ Clock-Prefix.pch.pch error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) 1 error generated. /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:7:9: fatal error: could not build module 'Darwin' #import ~~~~~~~^ error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: In file included from :1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:9: fatal error: could not build module 'Darwin' #import ~~~~~~~^ error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8: While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6: In file included from :1: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:10: fatal error: could not build module 'Darwin' #include ~~~~~~~~^ 2 errors generated. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module 'CoreFoundation' #include ~~~~~~~~^ error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8: While building module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6: In file included from :1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/objc/message.h:28: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/objc/objc.h:31:10: fatal error: could not build module 'Darwin' #include // for __DARWIN_NULL ~~~~~~~~^ 2 errors generated. error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8: While building module 'Security' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9: In file included from :1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:24: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:32:10: fatal error: could not build module 'Darwin' #include ~~~~~~~~^ 2 errors generated. 8 errors generated. error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: While building module 'CoreGraphics' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:8: In file included from :1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:159:11: fatal error: could not build module 'Darwin' # include ~~~~~~~~^ 2 errors generated. error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: While building module 'CoreImage' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIColor.h:10: In file included from :1: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.h:8:9: fatal error: could not build module 'Foundation' #import ~~~~~~~^ error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:16:10: fatal error: could not build module 'Darwin' #include ~~~~~~~~^ 2 errors generated. 4 errors generated. error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: While building module 'CoreText' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/NSText.h:9: In file included from :1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h:20: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTDefines.h:29:11: fatal error: could not build module 'Darwin' # include ~~~~~~~~^ 2 errors generated. error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: While building module 'QuartzCore' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UICollectionViewLayout.h:11: In file included from :1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAAnimation.h:6: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h:6: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h:6: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h:13: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/include/stdint.h:33:16: fatal error: could not build module 'Darwin' # include_next ~~~~~~~~~~~~~^ error: invalid deployment target '5.0.0' for architecture 'arm64' (requires '7.0.0' or later) While building module 'UIKit' imported from /Users/jonathan/Desktop/Steampunk Clock/Steampunk Clock/Steampunk Clock-Prefix.pch:14: While building module 'QuartzCore' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UICollectionViewLayout.h:11: While building module 'OpenGLES' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAEAGLLayer.h:7: In file included from :1: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h:8:10: fatal error: could not build module 'Foundation' #include ~~~~~~~~^ 2 errors generated. 4 errors generated. 22 errors generated. 25 errors generated.
So it looks like I have asked for iOS 5.0 compatibility for a 64-bit device; how do I clear that?
所以看起来我已经要求 64 位设备兼容 iOS 5.0;我该如何清除?
And how else can I address these errors?
我还能如何解决这些错误?
回答by Tommie C.
The answer can be found by a close reading of the error. It appears to indicate that arm64 is not supported for your app which is targeting 5.0.0. If this answer satisfy's your use-case please don't forget to accept the answer so that other users will locate the solution.
可以通过仔细阅读错误来找到答案。它似乎表明您的目标是 5.0.0 的应用程序不支持 arm64。如果此答案满足您的用例,请不要忘记接受答案,以便其他用户找到解决方案。
High-level concepts
高级概念
Arm64 was just introduced to support iOS7 so it did not exist on iOS5 devices. Something to keep in mind is that iOS5 devices will not support any of the iOS7 specific features.
Arm64 刚刚被引入以支持 iOS7,所以它在 iOS5 设备上不存在。需要记住的是,iOS5 设备将不支持任何 iOS7 特定功能。
Low-level detail
低级细节
Specific to the error you are seeing:
特定于您看到的错误:
Note the definition of the Valid Architecture settings:
请注意有效架构设置的定义:
A space-separated list of architectures for which the target should actually be built. For each target, this list is intersected with the list specified in 'Architectures', and the resulting set is built. This allows individual targets to “opt out” of building for particular architectures. If the resulting set of architectures is empty, no executable will be produced. [VALID_ARCHS]
实际应为其构建目标的以空格分隔的体系结构列表。对于每个目标,此列表与“架构”中指定的列表相交,并构建结果集。这允许单个目标“选择退出”特定架构的构建。如果生成的架构集为空,则不会生成任何可执行文件。[VALID_ARCHS]
You can change the architecture of the device you are targeting by removing the arm64 text from your debug/release code. The effect of this is that your app will run in 32 bit mode only on 5s devices. Your current error should disappear when you remove the arm64 setting.
您可以通过从调试/发布代码中删除 arm64 文本来更改目标设备的架构。这样做的效果是您的应用程序将仅在 5s 设备上以 32 位模式运行。当您删除 arm64 设置时,您当前的错误应该会消失。
Select your Project > Click on Build Settings >
选择您的项目 > 单击构建设置 >
Search for 'arch' (no quotes) >
搜索“arch”(无引号)>
Double-click into the White Space (Under the Target and Project Column) > Select arm64 > Hit the Minus button on the bottom of the popup box
双击空白区域(在目标和项目列下)> 选择 arm64 > 点击弹出框底部的减号按钮
回答by Adam Richardson
iOS5 is a 32bit operating system.
iOS5是32位操作系统。
If you want to support a deployment target of iOS5 then you need to go to the Build Settings and remove arm64 from the architectures, but leave it in the valid architectures. Just keep armv7 and armv7s. 64 bit devices (at this moment only the iPhone5 S) are capable of running 32 bit code. So unless you have written code to take advantage of the 64bit processor then arm64 is not vital to be included in the architectures.
如果要支持 iOS5 的部署目标,则需要转到 Build Settings 并从架构中删除 arm64,但将其保留在有效架构中。只保留 armv7 和 armv7s。64 位设备(目前只有 iPhone5 S)能够运行 32 位代码。因此,除非您编写了代码来利用 64 位处理器,否则 arm64 对包含在体系结构中并不重要。
If you really want to support arm64 or you have no requirement to support any older versions of iOS then you will need to change the deployment target to iOS7
如果你真的想支持 arm64 或者你不需要支持任何旧版本的 iOS 那么你需要将部署目标更改为 iOS7
回答by ryan cumley
A significant amount of these errors want you to change your Deployment target from 5.0 to 7.0
大量这些错误希望您将部署目标从 5.0 更改为 7.0
If you do change it to 7.0, it means that people running iOS7 will be able to download and run your app, but anyone with an older version of iOS will not.
如果您确实将其更改为 7.0,则意味着运行 iOS7 的人将能够下载和运行您的应用程序,但任何使用旧版本 iOS 的人都无法下载和运行您的应用程序。
Alternately, if you want to support older versions of iOS, you'll have to find all the parts of your code which are not supported by older versions, and write some supporting code.
或者,如果您想支持旧版本的 iOS,您必须找到旧版本不支持的所有代码部分,并编写一些支持代码。
Changing the target is easy, it's on the "General" tab of the app's target.
更改目标很容易,它位于应用程序目标的“常规”选项卡上。