有没有其他人有问题确定并不总是被调用?有时我打电话
[self.locationManager requestStateForRegion:region];
Run Code Online (Sandbox Code Playgroud)
没有任何反应.奇怪的是,当我插入一个断点时
-(void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region
Run Code Online (Sandbox Code Playgroud)
它开始工作和被召唤!对我来说似乎很不稳定.
Jef*_*mes 13
在监控区域后立即请求区域状态时,我经常遇到此问题.
例如
[self.locationManager startMonitoringForRegion:region];
[self.locationManager requestStateForRegion:region];
Run Code Online (Sandbox Code Playgroud)
我确保调用requestStateForRegion调用didDetermineStateForRegion:调用startMonitoringForRegion后不久.现在它不是一个很好的解决方案,它应该小心使用,但它似乎解决了这个恼人的问题.代码如下
[self.locationManager startMonitoringForRegion:region];
[self.locationManager performSelector:@selector(requestStateForRegion:) withObject:region afterDelay:1];
Run Code Online (Sandbox Code Playgroud)