Location Manager Error

I use location manager

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

I added corelocation.framework to the framework folder of my project, the project was successful at cleaning, but could not and gave the same three errors when building

+4
source share
4 answers

You need to import the Framework that you have already done, also add the following to your .h file, where you use the CLLocation class, for example

 #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface UntitledViewController : UIViewController <CLLocationManagerDelegate> { CLLocationManager* locationManager; CLLocation* locationObject; } @end 

Hope this helps!

+7
source

Deleting and adding a frame back is the right solution. Thanks for the answer, it saved me a lot of work.

+2
source

I encountered the same problem in my unit test project.

The problem was that I added CoreLocation.framework to my project, but forgot to add unit test to the project.

+1
source

Try adding this to your class.

 #import <CoreLocation/CoreLocation.h> 
0
source

Source: https://habr.com/ru/post/1384046/


All Articles