swift - 如何用 CLLocationDegrees 解决这个问题?
问题描述
我试图根据表格视图中单元格的数量打开不同的位置,所以我写了这个函数:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let latitude: CLLocationDegrees = self.latitudes[indexPath.row]
let longitude: CLLocationDegrees = self.longitude[indexPath.row]
let coordinate = CLLocationCoordinate2DMake(latitudes,longitude)
let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: coordinate, addressDictionary:nil))
mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving])
}
但是,Xcode 给了我这个错误“无法将类型'[CLLocationDegrees]'(又名'Array')的值转换为预期的参数类型'CLLocationDegrees'(又名'Double')”
有人知道我该怎么办吗?
解决方案
推荐阅读
- windows - 用户注销时运行文件
- typescript - 在 vue + typescript 中使用 mapState
- python - 为 DB2 中的表生成散列值时出错
- jquery - 如何使用 jQuery 中的滑块更改样式的值
- javascript - 如何将大小值字符串更改为数字
- python - 如何在预提交时运行具有本地存根目录的 mypy?
- java - 如何允许 Apache Camel 中的所有 ssl 服务?
- java - 如何在Struts 2中动作类的prepare方法中获取URL参数
- r - R:所有变量值都相同
- css - 我应该在我的 CSS 中使用 -webkit-box-shadow 还是只使用 box-shadow?