tal*_*999 5 mapkit swift xcode6
使用MKMapRectMake创建MKMapRect会导致编译错误,如下所示:
这是我的代码:
var lat = 37.33072
var lon = -122.029674
var loc = CLLocationCoordinate2D(latitude: lat, longitude: lon)
var point = MKMapPointForCoordinate(loc)
var flyTo = MKMapRectMake(point.x, point.y, 0, 0);
Run Code Online (Sandbox Code Playgroud)
这是编译器的错误:
Undefined symbols for architecture i386:
"_MKMapPointMake", referenced from:
_MKMapRectMake in ViewController.o
"_MKMapSizeMake", referenced from:
_MKMapRectMake in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
我的解决方法是使用origin和size参数创建MKMapRect.请注意,我已将MKMapKit添加到Build Phases中的链接库中
有没有人遇到同样的问题以及你如何解决这个问题?
使用实用功能解决它:
func myMKMapRect(x: Double, y:Double, w:Double, h:Double) -> MKMapRect {
return MKMapRect(origin:MKMapPoint(x:x, y:y), size:MKMapSize(width:w, height:h))
}
Run Code Online (Sandbox Code Playgroud)
当然,还要向Apple提交错误报告.
| 归档时间: |
|
| 查看次数: |
695 次 |
| 最近记录: |