I have 2 methods to be executed on a button click event say method1: and method2: .Both have network calls and so cannot be sure which one will fin
You could just use a flag (aka a BOOL variable) that lets you know in either methods (A or B) if the other one has completed yet. Something on the lines of this:
- (void) methodA
{
// implementation
if (self.didFinishFirstMethod) {
[self finalMethod];
} else {
self.didFinishFirstMethod = YES;
}
}
- (void) methodB
{
// implementation
if (self.didFinishFirstMethod) {
[self finalMethod];
} else {
self.didFinishFirstMethod = YES;
}
}
- (void) finalMethod
{
// implementation
}
Cheers!