Xcode 4.0.1中有关CoreLocation框架的未定义符号错误

时间:2011-05-31 23:13:16

标签: ios4

我正在完成第一个核心数据教程“地点”。我已经完成了教程的第一部分,它设置了NavigationController和TableViewController以及向委托添加CoreLocation调用。当我构建/运行时,我收到以下错误:

Ld /Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Products/Debug-iphonesimulator/Locations.app/Locations normal i386
cd /Users/parradoxx/Projects/Locations
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/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Products/Debug-iphonesimulator -F/Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Products/Debug-iphonesimulator -F/Users/parradoxx/Projects/Locations -filelist /Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Intermediates/Locations.build/Debug-iphonesimulator/Locations.build/Objects-normal/i386/Locations.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework CoreLocation -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -o /Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Products/Debug-iphonesimulator/Locations.app/Locations

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CLLocationManager", referenced from:
      objc-class-ref in RootViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

我已经阅读过有关需要链接CoreLocation框架的类似帖子,而且据我所知,我已经知道了。实际上,它在Frameworks目录中已经有两次了。但是,我怀疑它是一个链接器问题,这让我头疼。我看到的混淆是当针对iOS时对MACOS的引用。

自从它成为可用以来,我一直在成功使用Xcode 4。这是我对XCode的第一次打嗝,它让我有点迷失。我很乐意按要求提供更多信息。

2 个答案:

答案 0 :(得分:16)

链接到CoreLocation.framework很容易。在XCode4中,单击左列顶部的项目图标(项目导航器)以在主区域中查找构建阶段。在Build Phases选项卡下,展开Link Binary With Libraries选项卡。单击+号从列表中选择CoreLocation.framework。就是这样!

答案 1 :(得分:0)

右键单击项目图标(xcode),然后选择show in folder,您将找到一个名为CoreLocation.framework的框架,只需将其拖放到项目文件列表(xcode)中的Frameworks文件夹即可。不要忘记将#import和CLLocationManagerDelegate添加到.h文件中: - )