我正在调用四个要以同步顺序执行的方法,前两个方法是同步的,后两个方法是异步的(从 URL 获取数据)。
伪代码:
- (void)syncData {
// Show activity indicator
[object sync]; // Synchronous method
[object2 sync]; // Synchronous method
BOOL object3Synced = [object3 sync]; // Async method
BOOL object4Synced = [object4 sync]; // Async method
// Wait for object3 and object4 has finished and then hide activity indicator
}
我怎样才能做到这一点?