我正在尝试将我的swift 1.2应用程序转换为2.0.我尝试了一些我在互联网上找到的修复程序,但它不起作用.
错误: Converting to Swift 2.0 - Cannot Subscript a value of type '[CLPlacemark]?'
码:
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
CLGeocoder().reverseGeocodeLocation(manager.location!, completionHandler: {(placemarks, error)->Void in
if (error != nil)
{
print("Error: " + error!.localizedDescription)
return
}
if placemarks!.count > 0
{
let pm = placemarks[0] as! CLPlacemark
self.displayLocationInfo(pm)
}
else
{
print("Error with the data.")
}
})
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1242 次 |
| 最近记录: |