Question

I have an viewController that fires a web service get some data and stores the result in core data after parsing in a different thread..

I have a lot of data so parsing will take some time and am not sure if popping the viewController in navigation will stop the execution of my parsing method,

if it stops the execution in between then my core data DB will get corrupted so does it stops the execution or perform the selector before releasing my viewController object

MyViewController *vc = [[MyViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc performSelectorInBackground:aSelector withObject:arg];
Was it helpful?

Solution

You might consider moving the web server interactions to a different object. This object could handle the requests / responses and storing the results to Core Data. This object might also be a global object with a queue to handle requests. If not then you will need to handle canceling the request during your view controller dealloc.

Your view controllers can listen for changes to Core Data and take appropriate action.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top