开发者

CLLocationCoordinate2D invalid initializer

I am using CLLocationCoordinate2D in to assign latitude and longitude like this

 CLLocationDegrees latitude = [somelat doubleValue];
 CLLocationDegrees longitude = [somelongi doubleValue];
 CLLocationCoordinate2D coordinate = CLLocationCo开发者_Python百科ordinate2DMake(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.

How can i resolve this...Please anybody suggest me a solution to this problem

Thanks and regards, Sankar Chandra Bose


CLLocationCoordinate2DMake is available only on iOS 4.0 and later. Do this rather,

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


CLLocationCoordinate2DMake is available only from 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.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜