I'm pretty new to iOS development and been wrestling to tasks for a while. Decided to ask for help eventually.
I have some data to be loaded from internet before I let the app to be launched. I've decided to use didFinishLaunchingWithOptions
in AppDelegate
There it is:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
//loading configuration
[Configuration downloadConfiguration:^(NSMutableArray *currencies, double refreshIntervalInMilis, double timeDifferenceInMilis, NSError *error) {
if (error) {
//displaying error dialog
} else {
//doing some stuff with data loaded
}
}];
return YES;
}
It's obvious that the method will return YES before the data is loaded, because it doesn't wait for data to be loaded. My question is How do I make this method wait for this block be completed before I return YES (or NO if configuration was not loaded properly)?