From Main UIViewController
I call
if (required) [dataDB function];
next command;
....
....
in the Database UIViewController
- (void) Function {
Display Alert Message for Processing;
performs steps (takes some time)
....
....
Close Alert Message
}
Although one should NOT block code
I need the [dataDB Function] to complete before next command is called;
Yet I need the Alert to start showing before perform steps starts.
Currently Alert appears after [dataDB Function] completes and closes almost immediately.
Please help.
try this code
if (required)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[dataDB function];
dispatch_async(dispatch_get_main_queue(), ^{
next command;
});
});
}
it will create async task of [dataDB function];
and after competition of it, it will perform task on main queue of next command;