1

我有一个问题,我不知道如何解决它。

我的代码看起来像这样

CLLocationCoordinate2D coord[12]; 
coord[0] = CLLocationCoordinate2DMake(52.5041,13.351);

它说:

缺少类型说明符,默认为 'int'

我不明白为什么。当我在寻找提示时,我尝试了不同的想法,甚至在此页面上看到了类似的代码。

Gz阿德里安

4

1 回答 1

0

根据文档:

CLLocationCoordinate2D CLLocationCoordinate2DMake(CLLocationDegrees latitude, CLLocationDegrees longitude)

typedef double CLLocationDegrees;

当你写CLLocationCoordinate2DMake(52.5041,13.351); 52.504113.351可能不被认为是双重的。

试试这样:

NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc]init];
[numberFormatter setNumberStyle:kCFNumberFormatterDecimalStyle];
NSNumber *lat = [numberFormatter numberFromString:@"52.5041"];
NSNumber *lng = [numberFormatter numberFromString:@"13.351"];
coord[0] = CLLocationCoordinate2DMake(lat,lng);
于 2014-05-21T13:04:33.620 回答