简体   繁体   English

CLLocationCoordinate2D无效的初始化程序

[英]CLLocationCoordinate2D invalid initializer

I am using CLLocationCoordinate2D in to assign latitude and longitude like this 我正在使用CLLocationCoordinate2D这样分配纬度和经度

 CLLocationDegrees latitude = [somelat doubleValue];
 CLLocationDegrees longitude = [somelongi doubleValue];
 CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(latitude, longitude);

When i run this code in iPhone simulator its not showing error but wheni run the same application in ios simulator 3.2 that is the iPad simulator its showing me an "Invalid Initializer" error. 当我在iPhone模拟器中运行此代码时,它没有显示错误,但是当我在ios模拟器3.2中运行了相同的应用程序时,即iPad模拟器,它向我显示了“无效的初始化程序”错误。

How can i resolve this...Please anybody suggest me a solution to this problem 我该如何解决...请任何人建议我解决此问题

Thanks and regards, Sankar Chandra Bose 感谢和问候,Sankar Chandra Bose

CLLocationCoordinate2DMake is available only on iOS 4.0 and later. CLLocationCoordinate2DMake仅在iOS 4.0及更高版本上可用。 Do this rather, 这样做,

CLLocationCoordinate2D coordinate;
coordinate.longitude = longitude;
coordinate.latitude = latitude;

CLLocationCoordinate2DMake is available only from ios 4.0. CLLocationCoordinate2DMake仅在ios 4.0中可用。 Check the reference 查看参考

CLLocationCoordinate2DMake

Formats a latitude and longitude value into a coordinate data structure format. 将纬度和经度值格式化为坐标数据结构格式。

CLLocationCoordinate2D
> CLLocationCoordinate2DMake(   
> CLLocationDegrees latitude,   
> CLLocationDegrees longitude)

Parameters 参量

latitude 纬度

 The latitude for the new coordinate. longitude The longitude for the new coordinate. 

Return Value 返回值

A coordinate structure encompassing the latitude and longitude values. 包含纬度和经度值的坐标结构。

Availability 可用性

  • Available in iOS 4.0 and later. 在iOS 4.0及更高版本中可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM