【发布时间】:2015-09-27 11:44:03
【问题描述】:
我已升级到 Xcode 7,但突然间我的一个目标无法构建,并显示“宏名称必须是标识符”消息。这个目标的调试配置构建得很好,我可以在设备上运行它,但是发布配置没有构建。
错误指向目标的 .pch 文件,但相同的 .pch 文件对于许多其他目标(包括已发布的目标)都可以构建。
这是错误信息:
ProcessPCH /Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/PrecompiledHeaders/speedometer-Prefix-copscroeimdxfkdvcsfifjmzires/speedometer-Prefix.pch.pch speedometer/speedometer-Prefix.pch normal armv7 c com.apple .compilers.llvm.clang.1_0.compiler cd /Users/stanislavdvoychenko/Documents/code/speedo 导出 LANG=en_US.US-ASCII export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/ usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c-header -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace -limit=0 -std=gnu99 -gmodules -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Wunreachable-code -Wno-missing-braces -W括号-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 -DCCOOAPODS=1 -DCCOOAPODS=1 -DTAXI -D =1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -fstrict-aliasing -Wdeprecated-declarations -miphoneos-version-min=7.0 -g -fvisibility =隐藏 -Wno-sign-conversion -I/Users/stanislavdvoychen ko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/speedo.build/Release-iphoneos/taximeter.build/taximeter.hmap -I/Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo- gagyicfwqpzsudcvwgxjqhwbgpte/Build/Products/Release-iphoneos/include -I/Users/stanislavdvoychenko/Documents/code/speedo/Pods/Headers/Public -I/Users/stanislavdvoychenko/Documents/code/speedo/Pods/Headers/Public/GoogleMaps - I/Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/speedo.build/Release-iphoneos/taximeter.build/DerivedSources/armv7 -I/Users/stanislavdvoychenko/Library/Developer/Xcode/ DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/speedo.build/Release-iphoneos/taximeter.build/DerivedSources -F/Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Products/Release-iphoneos F/Users/stanislavdvoychenko/Documents/code/spe edo/Pods/GoogleMaps/Frameworks -F/Users/stanislavdvoychenko/Documents/code/speedo -DNS_BLOCK_ASSERTIONS=1 -isystem /Users/stanislavdvoychenko/Documents/code/speedo/Pods/Headers/Public -isystem /Users/stanislavdvoychenko/Documents/代码/speedo/Pods/Headers/Public/GoogleMaps -MD -MT 依赖项-MF /Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/PrecompiledHeaders/speedometer-Prefix-copscroeimdxfkdvcsfifjmzires/speedometer-Prefix .pch.d -c /Users/stanislavdvoychenko/Documents/code/speedo/speedometer/speedometer-Prefix.pch -o /Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/PrecompiledHeaders/speedometer -Prefix-copscroeimdxfkdvcsfifjmzires/speedometer-Prefix.pch.pch --serialize-diagnostics /Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/PrecompiledHeaders/speedometer-Prefix-copscro eimdxfkdvcsfifjmzires/speedometer-Prefix.pch.dia 在来自 :334 的文件中: :4:10: 错误:宏名必须是标识符 #定义1 ^ 产生 1 个错误。这是 .pch 文件:
#进口 #ifndef __IPHONE_4_0 #warning "此项目使用仅在 iOS SDK 4.0 及更高版本中可用的功能。" #万一 #ifdef __OBJC__ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "枚举.h" #万一 #define APP ((AppDelegate *)[[UIApplication sharedApplication] delegate])我已经尝试过干净和 Xcode 重启。
如果我能更深入地挖掘并找出问题所在,我将不胜感激。
【问题讨论】:
-
我遇到了类似的问题,它是针对枚举的。您可以使用 enums.h 中的枚举更新您的问题吗?
-
我删除了“Enums.h”行,但仍然存在同样的问题。那应该是别的东西。我会分享“Enums.h”,但它很大。试图同时在项目的 git 历史中找到任何东西......
标签: ios objective-c xcode