开发者

MapKit and custom classes

开发者 https://www.devze.com 2023-02-23 17:36 出处:网络
I created a Custom Class that stores some data. One piece of data that I want to store is CLLocationCoordinate2D

I created a Custom Class that stores some data.

One piece of data that I want to store is

CLLocationCoordinate2D

What headers do I need to include to be able to use/s开发者_开发知识库tore this data type?

I thought it was MapKit and when I add the following lines to my Person.h file, i get errors

#import <MapKit/MapKit.h>

Error: MapKit.MapKit.h No such file or directory

CLLocationCoordinate2D gpsData;

Error: Expeected specificier-qualifier-list expected before 'CLLocationCoordinate2D'


A quick look at the documentation for CLLocationCoordinate2D reveals that that type is declared in CLLocation.h. You should add the CoreLocation framework to your project and #import <CoreLocation/CoreLocation.h>.


The compiler error...

Error: MapKit.MapKit.h No such file or directory

Indicates that XCode cannot find the MapKit.h header file on its build path. You need to include the MapKit framework in your application. To do so in XCode 4+ ...

  • Open your XCode Project (double click on the project file)
  • Select your application target (you'll likely have one which matches the application name)
  • Choose the 'Build Phases' tab for the target
  • Click the + button in the 'Link With Libraries' section
  • Search for 'MapKit' and select it

You may need to add the framework for any other target that needs to link with MapKit i.e. a tests target.

0

精彩评论

暂无评论...
验证码 换一张
取 消