I have set of coordinates saved in array. I am usin开发者_开发百科g reverse geocoder
The method i used,
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate altitude:(CLLocationDistance)altitude horizontalAccuracy:(CLLocationAccuracy)hAccuracy verticalAccuracy:(CLLocationAccuracy)vAccuracy timestamp:(NSDate *)timestamp
I need to convert latitude,longitude in CLLocationCoordinate2D.
self.atmLocation.latitude = [tempDict objectForKey:@"Latitude"]; //atmlocation is of type CLLocationCoordinate2D.
This gives me an error "Expression is not assignable". How to solve this? And if this is not possible than please suggest any other way so i can use external set of coordinates.
The tempDict returns an object. Hence you need to convert it.
Try self.atmLocation.latitude = [(NSString *)[tempDict objectForKey:@"Latitude"]doublevalue];
From the documentation
typedef struct {
CLLocationDegrees latitude;
CLLocationDegrees longitude;
} CLLocationCoordinate2D;
typedef double CLLocationDegrees;
精彩评论