我有一个问题,我不知道如何解决它。
我的代码看起来像这样
CLLocationCoordinate2D coord[12];
coord[0] = CLLocationCoordinate2DMake(52.5041,13.351);
它说:
缺少类型说明符,默认为 'int'
我不明白为什么。当我在寻找提示时,我尝试了不同的想法,甚至在此页面上看到了类似的代码。
Gz阿德里安
我有一个问题,我不知道如何解决它。
我的代码看起来像这样
CLLocationCoordinate2D coord[12];
coord[0] = CLLocationCoordinate2DMake(52.5041,13.351);
它说:
缺少类型说明符,默认为 'int'
我不明白为什么。当我在寻找提示时,我尝试了不同的想法,甚至在此页面上看到了类似的代码。
Gz阿德里安
根据文档:
CLLocationCoordinate2D CLLocationCoordinate2DMake(CLLocationDegrees latitude, CLLocationDegrees longitude)
和
typedef double CLLocationDegrees;
当你写CLLocationCoordinate2DMake(52.5041,13.351);
52.5041
和13.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);