0
我定義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;
現在我通過位置獲取CLLocation實例經理代表
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation //self.myPosition是MyLocation myPosition; self.myPosition = newLocation; [myPosition setDatum:@「WGS 84」]; [myPosition setEllipsoid:@「WGS 84」]; }
當我做self.myPosition = newLocation我得到一個未捕獲的異常,以至於死
我也試過這種方式具有相同的結果:
self.myPosition = (MyLocation *)newLocation;