I have an array of CLLocation
data that I would like to archive. Should the NSUserDefaults
system be used? Otherwise, how best to archive the
Found out the solution using nsarchiver as you said it worked like charm thanks. Here is what i did.
- (id)initWithCoder:(NSCoder *)aDecoder
{
self.PlaceName=[aDecoder decodeObjectForKey:@"inapPlaceName"];
float lat, long1;
lat=[aDecoder decodeDoubleForKey:@"inapCoordinateLat"];
long1=[aDecoder decodeDoubleForKey:@"inapCoordinateLong"];
//inapCoordinate=[[CLLocationCoordinate2D alloc] initWithLatitude:lat1 longitude:long1];
CLLocationCoordinate2D new_coordinate = { lat, long1 };
self.inapCoordinate=new_coordinate;
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:PlaceName forKey:@"inapPlaceName"];
[aCoder encodeDouble:inapCoordinate.latitude forKey:@"inapCoordinateLat"];
[aCoder encodeDouble:inapCoordinate.longitude forKey:@"inapCoordinateLong"];
}