定位设置

1,在info.plst中设置以下键值:

NSLocationAlwaysUsageDescription

NSLocationWhenInUseUsageDescription

2,导入CoreLocation库

3,代理CLLocationManagerDelegate,代码:

if CLLocationManager.locationServicesEnabled()

{

let manger = CLLocationManager()

manger.startUpdatingHeading()

manager.startUpdatingLocation()

}

你可能感兴趣的:(定位设置)