从.pch文件中出现的Xcode编译错误?(iOS)

9
在修改一个iPhone应用程序时,我保存并编译,结果出现以下错误...... 然后撤消了所有更改,现在被这些错误困扰着。我尝试过清理构建、将文件从此文件夹复制出来、在另一台机器上构建等,但无论我想到什么方法都无法解决它,我所做的更改是针对.xib文件的;我删除了IBOutlet,因为我不再需要该元素。有人知道我如何解决这些问题吗?抱歉输出了这么长的调试信息,但我认为过多的信息总比过少好。
Build Hunter of project Hunter with configuration Debug

ProcessPCH /var/folders/di/diNSUsegESCJmVpYf71u4U+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Hunter_Prefix-ewmgimmftydqkieofchvanjjzzvq/Hunter_Prefix.pch.pth Hunter_Prefix.pch normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Users/stuartloxton/Documents/Hunter New"
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x objective-c-header -arch i386 -fmessage-length=0 -pipe -fdiagnostics-print-source-range-info -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -fvisibility=hidden -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote "/Users/stuartloxton/Documents/Hunter New/build/Hunter.build/Debug-iphonesimulator/Hunter.build/Hunter-generated-files.hmap" "-I/Users/stuartloxton/Documents/Hunter New/build/Hunter.build/Debug-iphonesimulator/Hunter.build/Hunter-own-target-headers.hmap" "-I/Users/stuartloxton/Documents/Hunter New/build/Hunter.build/Debug-iphonesimulator/Hunter.build/Hunter-all-target-headers.hmap" -iquote "/Users/stuartloxton/Documents/Hunter New/build/Hunter.build/Debug-iphonesimulator/Hunter.build/Hunter-project-headers.hmap" "-F/Users/stuartloxton/Documents/Hunter New/build/Debug-iphonesimulator" "-F/Users/stuartloxton/Documents/Hunter New" "-I/Users/stuartloxton/Documents/Hunter New/build/Debug-iphonesimulator/include" "-I/Users/stuartloxton/Documents/Hunter New/build/Hunter.build/Debug-iphonesimulator/Hunter.build/DerivedSources/i386" "-I/Users/stuartloxton/Documents/Hunter New/build/Hunter.build/Debug-iphonesimulator/Hunter.build/DerivedSources" -c "/Users/stuartloxton/Documents/Hunter New/Hunter_Prefix.pch" -o /var/folders/di/diNSUsegESCJmVpYf71u4U+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Hunter_Prefix-ewmgimmftydqkieofchvanjjzzvq/Hunter_Prefix.pch.pth

In file included from /Users/stuartloxton/Documents/Hunter New/Hunter_Prefix.pch:7:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:11:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIActivityIndicatorView.h:8:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:9:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:10:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:9:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:26:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h:60:23: error: expected function body after function declarator
   CFDataRef metadata) CG_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_0);
                       ^
In file included from /Users/stuartloxton/Documents/Hunter New/Hunter_Prefix.pch:7:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:11:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIActivityIndicatorView.h:8:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:9:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:10:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:9:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:21:32: note: instantiated from:
 # define CG_AVAILABLE_STARTING __OSX_AVAILABLE_STARTING
                                ^
<scratch space>:82:1: note: instantiated from:
 __AVAILABILITY_INTERNAL__MAC_10_7
 ^
In file included from /Users/stuartloxton/Documents/Hunter New/Hunter_Prefix.pch:7:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:11:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIActivityIndicatorView.h:8:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:250:91: error: expected a type
 + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
                                                                                           ^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:256:86: error: expected a type
 + (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
                                                                                      ^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:258:114: error: expected a type
 + (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0); // toView added to fromView.superview, fromView removed from its superview
                                                                                                                  ^
In file included from /Users/stuartloxton/Documents/Hunter New/Hunter_Prefix.pch:7:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:13:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:187:31: error: unknown type name 'UIApplicationState'
 @property(nonatomic,readonly) UIApplicationState applicationState __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
                               ^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:190:4: error: expected a type
 - (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void(^)(void))handler  __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
    ^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:191:28: error: expected a type
 - (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
                            ^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:202:45: error: expected a type
 - (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
                                             ^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:206:4: error: expected a type
 - (UIRemoteNotificationType)enabledRemoteNotificationTypes __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
    ^
In file included from /Users/stuartloxton/Documents/Hunter New/Hunter_Prefix.pch:7:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:73:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UITextView.h:82:22: error: unknown type name 'UIDataDetectorTypes'
 @property(nonatomic) UIDataDetectorTypes dataDetectorTypes __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);
                      ^
In file included from /Users/stuartloxton/Documents/Hunter New/Hunter_Prefix.pch:7:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:79:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIWebView.h:54:22: error: unknown type name 'UIDataDetectorTypes'
 @property(nonatomic) UIDataDetectorTypes dataDetectorTypes __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);
                      ^
11 errors generated.

请参考ADC论坛上的这个帖子来找到一个解决方法。 - slangley
2个回答

5

我刚遇到了iOS 4 SDK的同样问题。在将编译器从LLVM编译器1.5更改为LLVM GCC 4.2GCC 4.2后,一切都正常了。

这是Clang的一个bug吗?


更改编译器对我也起了作用;但目前为止,我无法将其归类为Clang的错误。我在其他地方也无法复现它。 - stuartloxton

0

看起来这是4.1版的一个bug,因此如果您尚未更新到4.2版,请将以下内容添加到您的前缀文件中:

#if TARGET_IPHONE_SIMULATOR
#define __IPHONE_OS_VERSION_MIN_REQUIRED 040100
#warning "Remove This in SDK 4.2, needed because of a bug in SDK 4.1"
#endif

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接