I've defined this subclass of CLLocation
MyLocation.h
@interface MyLocation: CLLocation {
NSString *datum;
NSString *ellipsoid;
}
@property(nonatomic,retain) NSString *ellipsoid;
@property(nonatomic,retain) NSString *datum;
MyLocation.m
@synthesize datum,ellipsoid;
Now i get a CLLocation instance through the location manager delegate
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
//self.myPosition is a MyLocation myPosition;
self.myPosition = newLocation;
[myPosition setDatum: @"WGS 84"];
[myPosition setEllipsoid: @"WGS 84"];
}
When i do the self.myPosition = newLocation i get an UNCAUGHT EXCEPTION and it dies
I've also tried this way with same results:
self.myPosition = (MyLocation *)newLocation;
Best Answer
newLocation is not an instance of ur subclass so doing that assignment or casting throws an error because it's an invalid cast, u should be seting the values of ur subclass that u want fromthe cllocation object something like
and so on