私が取り組んでいるプロジェクトでは、特定のファイルを解凍する必要がありました。このために、ライブラリSSZipArchiveを見つけました。私はこれをXcode 4.2に含めました(クラスフォルダーを右クリック->プロジェクトにファイルを追加し、ダイアログで「項目を宛先グループのフォルダーにコピーする」-チェックボックスをオンにします)。libz ライブラリを含めます (libz と zlib1.2.5 の両方を試しました)。コンパイルしようとすると、突然 20 個のエラーが発生しました。
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:311:1: error: expected identifier or '(' [1]
@class NSString, Protocol;
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:313:19: error: unknown type name 'NSString' [1]
FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:314:44: error: unknown type name 'NSString' [1]
FOUNDATION_EXPORT SEL NSSelectorFromString(NSString *aSelectorName);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:316:19: error: unknown type name 'NSString' [1]
FOUNDATION_EXPORT NSString *NSStringFromClass(Class aClass);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:317:43: error: unknown type name 'NSString' [1]
FOUNDATION_EXPORT Class NSClassFromString(NSString *aClassName);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:319:19: error: unknown type name 'NSString' [1]
FOUNDATION_EXPORT NSString *NSStringFromProtocol(Protocol *proto) NS_AVAILABLE(10_5, 2_0);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:319:50: error: unknown type name 'Protocol' [1]
FOUNDATION_EXPORT NSString *NSStringFromProtocol(Protocol *proto) NS_AVAILABLE(10_5, 2_0);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:320:19: error: unknown type name 'Protocol' [1]
FOUNDATION_EXPORT Protocol *NSProtocolFromString(NSString *namestr) NS_AVAILABLE(10_5, 2_0);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:320:50: error: unknown type name 'NSString' [1]
FOUNDATION_EXPORT Protocol *NSProtocolFromString(NSString *namestr) NS_AVAILABLE(10_5, 2_0);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:324:30: error: unknown type name 'NSString' [1]
FOUNDATION_EXPORT void NSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:324:53:{324:53-324:76}: error: format argument not an NSString [3]
FOUNDATION_EXPORT void NSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
^~~~~~~~~~~~~~~~~~~~~~~
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:85:49: note: instantiated from:
#define NS_FORMAT_FUNCTION(F,A) __attribute__((format(__NSString__, F, A)))
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:325:31: error: unknown type name 'NSString' [1]
FOUNDATION_EXPORT void NSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0);
^
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:325:63:{325:63-325:86}: error: format argument not an NSString [3]
FOUNDATION_EXPORT void NSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0);
^~~~~~~~~~~~~~~~~~~~~~~
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:85:49: note: instantiated from:
#define NS_FORMAT_FUNCTION(F,A) __attribute__((format(__NSString__, F, A)))
これらはすべてコア ライブラリのエラーであるため、Xcode にライブラリを含める際に何か問題が発生した可能性があります。SSZipArchive が使用する minizip ライブラリに原因を絞り込むことができました (そのライブラリを削除すると、エラーは消え、コンパイラは正常に実行されます)。 .