我尝试从谷歌地图SDK中检索纬度和经度值,好吧,我正在使用这个:
NSString *lati = [end_loc objectForKey:@"lat"];
NSString *longi = [end_loc objectForKey:@"lng"];
marker.position = CLLocationCoordinate2DMake(lati, longi);
但是在标记位置行中,我收到此错误:
Passing 'NSString *__strong' to parameter of incompatible type 'CLLocationDegrees' (aka 'double')
关于如何解决它的任何想法?
这是因为 CLLocationCoordinate2DMake 希望 CLLocationDegrees 作为一种参数类型,并且您传递 NSStrings(或键纬度/纬度的end_lok
)。您可以尝试像这样解决它:
NSString *lati = [end_loc objectForKey:@"lat"];
NSString *longi = [end_loc objectForKey:@"lng"];
marker.position = CLLocationCoordinate2DMake([lati doubleValue], [longi doubleValue]);