Google的API要求您初始化CLLocationManager。既然你已经有了位置管理器,你可以将你的类设置为CLLocationManagerDelegate。这为您提供了意味着你可以同时获得一个确切的位置以及位置已改变
为了得到一个确切的位置通知原生的iOS方法:
[self.locationManager requestLocation]; //Get the current location once (iOS 9 and above)
要监视的位置:
[self.locationManager startUpdatingLocation] // Ask for the current location until you call stopUpdatingLocation
// or
[self.locationManager startMonitoringSignificantLocationChanges] // Tells you when your location has greatly changed
然后您需要符合协议,该协议至少有2种方法:
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray<CLLocation *> *)locations
// Do anything that you need to do once you have a location update
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error
// Your location update failed, handle it
什么v你有没有收到可能性? – KENdi
@KENdi - 我收到的值在0到1之间,但最大的值不是我当前的地方。那么我怎样才能得到准确的可能性值? – iPatel