今天在编写《iphone3开发教程》中第七章的内容时,突然被一个错误搞晕了,改了好多地方都没成功,后来想在网上查查,结果还都是英文!庆幸的是,读懂了某一篇段,还真改正了过来,链接无误。下面和大家分享一下吧!
Ld build/Debug-iphonesimulator/Pickers.app/Pickers normal i386
cd /Users/wang/Documents/Pickers
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.0.sdk -L/Users/wang/Documents/Pickers/build/Debug-iphonesimulator -F/Users/wang/Documents/Pickers/build/Debug-iphonesimulator -filelist /Users/wang/Documents/Pickers/build/Pickers.build/Debug-iphonesimulator/Pickers.build/Objects-normal/i386/Pickers.LinkFileList -mmacosx-version-min=10.6 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/wang/Documents/Pickers/build/Debug-iphonesimulator/Pickers.app/Pickers
Undefined symbols:
"_AudioServicesCreateSystemSoundID", referenced from:
-[SingleController playwithSound] in SingleController.o
-[SingleController spin] in SingleController.o
"_AudioServicesPlaySystemSound", referenced from:
-[SingleController playwithSound] in SingleController.o
-[SingleController spin] in SingleController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
看到这么长的错误,虚了吧?不用害怕,其实解决的办法很简单!AudioToolbox不属于uikit框架,我们必须把项目链接到调用的函数所属于的框架中。在xcode左侧的group&files列表中,右击framworks文件,选择exiting frameworks,选择AudioToolbox.framworks之后再编译运行就没错了。
下面简单说一下FrameWork。它是一些类的集合,通常是一些可能一起使用的类集合.换句话说,这些类被一起编译成可复用的代码库(library of code)。所有相关的资源和代码库一起放入一个带扩展名“.framework”的目录(Mac OSX bundle 的概念可以参考苹果的一些文档). 系统自带的framework可以在/System/Library/Frameworks找到. 几个基本的framworks:
1. Foundation: 所有的面向对象语言都会有一些标准结构: value , collection , String, dates, lists, thread等等.所有的这些都在Foundation framework里面(可以对比C++的STL)
2. Appkit: 所有和用户界面相关的类都在这里. Windows,buttons,text field, event, drawing. 它还有个名字: ApplicationKit
3. Core Data: Core Data可以方便的让你把你的对象存储成文件,或是从文件中加载你的对象.
供稿者 sunshine
转自: http://hi.baidu.com/herozoo/blog/item/2603653caef8c5d69f3d6231.html