私のアプリでstartUpdatingLocationを呼び出すと、デバイスが位置データを収集していると推測している間、UIが一時的にロックされることに気付きました。これは典型的なものであり、これを制限する方法はありますか?これが私のコードの様子です
-(void)getUserLocation {
if (!locationManager)
{
locationManager = [[CLLocationManager alloc]init];
}
[locationManager setDelegate:self];
[locationManager startUpdatingLocation];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
self.userCoordinate = newLocation.coordinate;
NSLog(@"user coordinate in location manager: %f,%f",self.userCoordinate.latitude,self.userCoordinate.longitude);
[locationManager stopUpdatingLocation];
locationManager = nil;
userLocationAvailable = YES;
[self getDataForScrollView];
}
何か案は?ありがとう!