1.創(chuàng)建CoreLocation的管理者(CLLocationManager)
2.CoreLocation的管理者的delegate監(jiān)聽獲取到的位置(CLLocationManagerDelegate)
3.開始監(jiān)聽(開始獲取位置)
iOS 8把位置服務(wù)權(quán)限拆分了兩個不同的授權(quán)(requestAlwaysAuthorization, requestWhenInUseAuthorization), CLLocationManager的startUpdatingLocation方法需要在CLLocationManagerDelegate的didChangeAuthorizationStatus:里面調(diào)用
除此之外iOS 8還需要在info.plist文件里面添加NSLocationUsageDescription關(guān)鍵字, 它在iOS 8被拆分了兩個不同的String(關(guān)鍵字NSLocationWhenInUseUsageDescription, NSLocationAlwaysUsageDescription), 如果不添加調(diào)用startUpdatingLocation不會有任何的彈窗提示給用戶