相关疑难解决方法(0)

检查swift中的互联网连接是否可用

是否有Apple框架捆绑包来检测是否存在互联网连接?目前我的应用程序在尝试在没有互联网连接的情况下对用户的位置进行地理定位时崩溃.

/*inside locationManager didUpdateLocations method*/
var currentLocation:CLLocation? = locations[0] as? CLLocation
geocoder = CLGeocoder()
//Crashes on line below when there isn't an internet connection
//Need to add function to check if internet connection is live 
//Before running reverseGeocodeLocation
geocoder.reverseGeocodeLocation (currentLocation,handleGeocode)
Run Code Online (Sandbox Code Playgroud)

我对swift和ios编程有点新鲜 - 我的道歉.

ios swift

10
推荐指数
1
解决办法
2万
查看次数

标签 统计

ios ×1

swift ×1