I have a class called MapPoint which represents an MKAnnotation on a MapView. I want to archive the MapPoint so it can persist. I am having trouble figuring out how to archive a structure (specifically CLLocationCoordinate2D) using the method - (void)encodeWithCoderNSCoder *)encoder. The documentation says that you cannot encode structures and need to pull out each variable within the structure that you want to archive. The CLLocationCoordinate2D is a structure that takes this form:
typedef struct {
CLLocationDegrees latitude;
CLLocationDegrees longitude;
} CLLocationCoordinate2D;
CLLocationDegrees is of the form:
typedef double CLLocationDegrees
It appears I need to put latitude and longitude each into a float variable and archive them that way.
Any help as to how I would go about doing this would be extremely helpful.
Thank you!!!
typedef struct {
CLLocationDegrees latitude;
CLLocationDegrees longitude;
} CLLocationCoordinate2D;
CLLocationDegrees is of the form:
typedef double CLLocationDegrees
It appears I need to put latitude and longitude each into a float variable and archive them that way.
Any help as to how I would go about doing this would be extremely helpful.
Thank you!!!