Apple Core Data教程中的奇怪错误

Max*_*kov 4 iphone xcode ios xcode4

我正在做Apple Core数据教程,并且在第一次建议我构建项目时,我收到了这个错误:

Ld /Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Products/Debug-iphonesimulator/Locations.app/Locations normal i386
    cd "/Users/user/Documents/xcode 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/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Products/Debug-iphonesimulator -F/Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Products/Debug-iphonesimulator -filelist /Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/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 UIKit -framework Foundation -framework CoreGraphics -framework CoreData -o /Users/user/Library/Developer/Xcode/DerivedData/Locations-fajvunxiruohofbhzimrgekrpnqh/Build/Products/Debug-iphonesimulator/Locations.app/Locations

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CLLocationManager", referenced from:
      objc-class-ref in RootViewController.o
  "_kCLLocationAccuracyNearestTenMeters", referenced from:
      -[RootViewController locationManager] in RootViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

我使用的是XCode 4.0.2,Mac OS X 10.6.8.这可能是什么原因?我一步一步地按照教程进行操作,完全不知道出了什么问题.

Kal*_*Kal 9

您需要导入CoreLocation框架.这可以通过项目 - 构建阶段 - 链接二进制与库来完成