I have a LocationManager in a viewController from where I want to listen for significant changes in user's location. Then, when locationManager:didUpdateToLocation:fromLocation: triggered, I perform some data processing by calling a custom object that is a private property of the same viewController and is always the same object:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
if (dataProcessor == nil) {
dataProcessor = [[DataProcessor alloc] initWithDefaultValues];
}
[dataProcessor processData:someData];
}
The method called by the dataProcessor, in turn, later makes calls to another self methods, and the whole processing performed by this dataProcessor may have not finished before locationManager:didUpdateToLocation:fromLocation: is reached again and then another [dataProcessor processData:someData] call is made.
My question is, what is supposed to be the behavior in this situation? Being the same object called, is the second call queued till the first one has finished? Or could the second call be executed between the call of the different methods called from the first processData call? I don't know how to see and debug this in Xcode. I need to ensure that data processing is performed and completed in the order in which new locations are notified by the Location Manager. I am not currently making use of any thread I've created, nor GCD queues, nor semaphores, because I am not sure what is really happening there and I don't know if I need any of those features.
Thanks a lot
processData
method will be executed as a serial queue, because it's executed on a main thread.