Skip to content

Instantly share code, notes, and snippets.

@MattFoley
Created June 18, 2013 21:41
Show Gist options
  • Save MattFoley/5809710 to your computer and use it in GitHub Desktop.
Save MattFoley/5809710 to your computer and use it in GitHub Desktop.
Logout wait for synchronous network requests.
dispatch_async(dispatch_get_main_queue(), ^{
[self.dialog setTitleString:@"Logging Out..."];
<Show Dialog>
});
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
#warning This would be better if our Network Utility ran off of the delegate protocol so we could cancel Network Requests.
do {
usleep(NSEC_PER_MSEC);
} while ([UIApplication sharedApplication].networkActivityIndicatorVisible);
usleep(NSEC_PER_MSEC);
dispatch_async(dispatch_get_main_queue(), ^{
<Dismiss HUD>
<Continue Logout>
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment