我有一个应用程序要完成,当我开始尝试通过执行模拟器来理解之前的开发人员所做的事情(我认为它是通过Xcode 3完成的),Xcode 4向我展示了25个问题:
Ld build/Debug-iphonesimulator/RadioPlayer.app/RadioPlayer normal i386
cd /Users/haithembenhammouda/Desktop/SonVidéo
setenv MACOSX_DEPLOYMENT_TARGET 10.6
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/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/haithembenhammouda/Desktop/SonVidéo/build/Debug-iphonesimulator -L/Users/haithembenhammouda/Desktop/SonVidéo/Classes/RadioKitLib -L/Users/haithembenhammouda/Desktop/SonVidéo -F/Users/haithembenhammouda/Desktop/SonVidéo/build/Debug-iphonesimulator -filelist /Users/haithembenhammouda/Desktop/SonVidéo/build/SonVidéo.build/Debug-iphonesimulator/RadioPlayer.build/Objects-normal/i386/RadioPlayer.LinkFileList -mmacosx-version-min=10.6 -ObjC -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -framework SystemConfiguration -framework MediaPlayer -framework CFNetwork -framework AudioToolbox -framework QuartzCore -lsqlite3.0 -framework AVFoundation -lRadioKit -framework MessageUI -o /Users/haithembenhammouda/Desktop/SonVidéo/build/Debug-iphonesimulator/RadioPlayer.app/RadioPlayer
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_RadioKit", referenced from:
objc-class-ref in RadioPlayerViewController.o
".objc_class_name_UIColor", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(BufferView.o)
".objc_class_name_UIView", referenced from:
.objc_class_name_BufferView in libRadioKit.a(BufferView.o)
".objc_class_name_NSObject", referenced from:
.objc_class_name_ASE_Event in libRadioKit.a(ASE_Event.o)
.objc_class_name_AudioStreamEngine in libRadioKit.a(AudioStreamEngine.o)
.objc_class_name_RadioKit in libRadioKit.a(RadioKit.o)
.objc_class_name_XMLMetaParser in libRadioKit.a(XMLMetaParser.o)
".objc_class_name_NSDate", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSValue", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSScanner", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSCharacterSet", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSAutoreleasePool", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
pointer-to-literal-objc-class-name in libRadioKit.a(XMLMetaParser.o)
pointer-to-literal-objc-class-name in libRadioKit.a(reachability.o)
".objc_class_name_NSFileManager", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSURLConnection", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
pointer-to-literal-objc-class-name in libRadioKit.a(XMLMetaParser.o)
".objc_class_name_NSThread", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
.....(etc)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
PS:我检查了框架,并且所有框架都存在。
答案 0 :(得分:24)
派对有点晚,但对于有此错误的人可能有价值。
我只是直接将一堆文件复制到Xcode项目中,如果您忘记将它们添加到项目构建阶段,您将收到错误"架构i386"的未定义符号。因此,将实现文件添加到Compile Sources,将Xib文件添加到Copy Bundle Resources。
错误告诉我,我的课程没有链接只是因为它们没有包含在编译源中,非常明显,但可能会让人头疼。
答案 1 :(得分:21)
在“构建阶段的链接二进制文件”列表中添加项目目标中使用的方法所需的框架,它将很容易地工作。 就像我导入到我的项目中一样
QuartzCore.framework
对于错误
架构i386的未定义符号:
答案 2 :(得分:2)
冒着明显的风险,请务必检查前向类文件的拼写。有时候XCode(至少是XCode 4.3.2)会将声明变为绿色,而实际上这个声明是错误的。就像在这个例子中一样:
"_OBJC_CLASS_$_RadioKit", referenced from:
objc-class-ref in RadioPlayerViewController.o
如果RadioKit是一个类文件并且你把它作为另一个文件的属性,那么在接口声明中你可能会看到
Radiokit *rk;
当实际的decalaration应为:时,将“Radiokit”设为绿色
RadioKit *rk;
此错误也会引发此类错误。另一个例子(在我的例子中)是你的通用应用程序的类名上有_iPhone和_iphone扩展名。一旦我将相应的文件从_iphone更改为正确的_iPhone,错误便消失了。
答案 3 :(得分:-5)
我找到了解决这个问题的方法,希望使用xCode 4.你所要做的就是从SimulatorSDK文件夹导入框架 的 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks 强>
我不知道当你尝试在真正的iDevice上测试你的应用程序时它是否有效,但我确信它可以在模拟器上运行。
享受