无法在 swift 中创建具有纬度和经度的苹果地图地址 link
Unable to create apple map address link with latitude and longitude in swift
我正在尝试用纬度和经度创建苹果地图地址link
我试过这样:
let addrLoction = addressModel[indexPath.row]
let coord = addrLo.location
latitude = coord?.latitude
longitude = coord?.longitude
let mapAddr = "http://maps.apple.com/?q={latitude},{longitude}"
获取错误:
Expected expression after operator
for eg: like android app goole maps address link, i need in apple map address link
两期:
latitude
和 longitude
是可选的。即使字符串插值语法正确,您也会得到类似 "Optional(45.000)"
的结果。使用可选绑定。
字符串插值语法错误,是\(value)
if let coord = addrLo.location {
let latitude = coord.latitude
let longitude = coord.longitude
let mapAddr = "https://maps.apple.com/?q=\(latitude),\(longitude)"
// ...
}
而 URL 方案应该是 https
我正在尝试用纬度和经度创建苹果地图地址link
我试过这样:
let addrLoction = addressModel[indexPath.row]
let coord = addrLo.location
latitude = coord?.latitude
longitude = coord?.longitude
let mapAddr = "http://maps.apple.com/?q={latitude},{longitude}"
获取错误:
Expected expression after operator
for eg: like android app goole maps address link, i need in apple map address link
两期:
latitude
和longitude
是可选的。即使字符串插值语法正确,您也会得到类似"Optional(45.000)"
的结果。使用可选绑定。字符串插值语法错误,是
\(value)
if let coord = addrLo.location { let latitude = coord.latitude let longitude = coord.longitude let mapAddr = "https://maps.apple.com/?q=\(latitude),\(longitude)" // ... }
而 URL 方案应该是 https