开发者

How to give coordinates from variable

开发者 https://www.devze.com 2023-03-21 23:54 出处:网络
I have set of coordinates saved in array. I am usin开发者_开发百科g reverse geocoder The method i used,

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消