Har*_*rsh 10 iphone objective-c cllocationcoordinate2d
我想将lat lon转换为CLLocationCoordinate2D.
self.currentLocation = {.latitude = 0.0, .longitude = 0.0};
Run Code Online (Sandbox Code Playgroud)
这给了我错误"预期的表达".
我究竟做错了什么?
Joe*_*Joe 25
使用CLLocationCoordinate2DMake(CLLocationDegrees latitude, CLLocationDegrees longitude)创建的坐标.
虽然你可以使用CLLocationCoordinate2DMake你得注意,因为它可在IOS 4.0及更高版本只.您可以尝试将其设置为"手动":
CLLocationCoordinate coordinate;
coordinate.latitude = 0.0;
coordinate.longitude = 0.0;
self.currentLocation = coordinate;
Run Code Online (Sandbox Code Playgroud)
你的代码似乎是正确的.这不应该抛出任何错误/警告.确保self.currentLocation是CLLocationCoordinate2D.尝试转换如下表达式,
self.currentLocation = (CLLocationCoordinate2D){.latitude = 0.0, .longitude = 0.0};
Run Code Online (Sandbox Code Playgroud)
或者,您也可以使用CLLocationCoordinate2DMake方法.
| 归档时间: |
|
| 查看次数: |
15935 次 |
| 最近记录: |