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

我正在完成第一个核心数据教程“地点”.我已经完成了本教程的第一部分,它设置了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的第一次打嗝,它让我有点迷失.我很乐意按要求提供更多信息.

解决方法

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

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...