This can be done by using a boolean to hold the return of the item until the building of the file is complete. If you want to show progress or have an activity indicator show on your main view, you can do this by calling it from the main thread. Here is a code snippet of this in action:
Set the Activity View Controller in your provider with this function in order to load a progress view.
self.parentViewController = parentVc;
Here is the item function with blocking and feedback view load.
self.wait = true;
[self prepareFile:^(){
[self performSelectorOnMainThread:@selector(dismissProgressView)
withObject:nil waitUntilDone:NO];
}];
[self performSelectorOnMainThread:@selector(loadProgressView)
withObject:nil waitUntilDone:NO];
while (self.wait) {
[self performSelectorOnMainThread:@selector(updateProgressView)
withObject:nil waitUntilDone:NO];
}
return self.completedUrl;
You can then create the three functions that are called on main thread to show a progress view, update the progress view while waiting for completion of the file. In the implementation of the dismissProgressView function, make sure to set the wait boolean to false when dismissViewController is complete.