In the view of my application, I have a subview that says "loading," and appears while cloud data is being synced.
In viewdidload, I have
// Reachability test.
BOOL isConnected = [self checkInternet];
// If we have connectivity, then sync data with cloud.
if(isConnected){
[self beginDataSync];
}else{
[self hideLoadingView];
}
and below I have this function.
- (void)beginDataSync{
SyncData *syncData = [[SyncData alloc] init];
[syncData syncDataStart];
[self startAnimatingIndicator];
do {
[syncData dropHoodsData];
// [syncData dropBarsData];
[syncData nameDataComparison];
[syncData locDataComparison];
[syncData setLocalNamess];
[syncData setLocNamePairs];
[syncData syncDataFinish];
} while ([syncData isSyncing]);
BOOL finishedSyncing = [syncData syncDataFinish];
if (finishedSyncing) {
[self performSelector:@selector(stopAnimatingIndicator) withObject:nil afterDelay:1.0];
}
[syncData release];
}
The sync works, everything logs out correctly, and the data is correct. The buggy behavior is the view does not load the "syncing" as it syncs (application just shows splash until the data is finished syncing). This makes the app seem like it is "hanging." I want it to load the view, with the loading subview is being displayed and data syncs, then when the sync is finished, it hides the subview. Any ideas what I am doing wrong?