1

(Xcode 3.2.6, iOS 4) I'm getting errors and build failure in a sample app. Apparently, there's an internal problem with CLLocationManager and its associated constants. I have no idea what's causing it or how to fix it.

I'm working through an Apple developer tutorial for CoreData on iPhone. The tutorial is a walkthrough of how to build an app called "Locations", which maintains a persistent list of the places a user has been. The user can commit his/her current location to the list by pressing a button, at which point the app runs some exemplary managed object logic. A location manager is set up at launch, and it runs continuously during the lifespan of the app.

My build is failing. This is troubling, since I'm entering code that Apple has provided. I'm getting two mysterious errors regarding my use of:
1.) a Core Location constant, kCLLocationAccuracyNearestTenMeters; and
2.) one of the classes, CLLocationManager.

These problems don't seem to originate from errors in my code. I've triple-checked that I'm typing everything correctly and in the proper places, and that I've imported the correct headers where necessary. The error entries in the build results window don't correspond to any line in the program. Instead, the problems appear to lie in .o files and low-level aliases.

Here are the logs from the results window (typed exactly as they appear):

"_kCLLocationAccuracyNearestTenMeters", referenced from:
_kCLLocationAccuracyNearestTenMeters$non_lazy_ptr in RootViewController.o
(maybe you meant: _kCLLocationAccuracyNearestTenMeters$non_lazy_ptr)

"_OBJC_CLASS_$_CLLocationManager", referenced from:
Objc-class-ref-to-CLLocationManager in RootViewController.o
Symbol(s) not found
Collect2: ld returned 1 exit status

Can anyone tell me what the source of the problem is, and what I can do to fix it? Thanks in advance.

Atulkumar V. Jain
  • 5,102
  • 9
  • 44
  • 61
  • Did you add the Core Location framework to your project? See: http://stackoverflow.com/questions/6987685/what-could-be-the-reason-for-this-error-during-build-undefined-symbols-for-arc –  Sep 22 '11 at 21:19
  • @AnnaKarenina Thanks so much! I thought using #import would perform all the necessary inclusion for me. I've got a lot to learn, it seems. Problem solved. – Sean Langhi Sep 23 '11 at 02:50

1 Answers1

1

You have to add coreLocation framework to your project.

Atulkumar V. Jain
  • 5,102
  • 9
  • 44
  • 61
MGZ
  • 21
  • 1