Skip to content

Instantly share code, notes, and snippets.

@Kentzo
Created August 9, 2010 04:46
Show Gist options
  • Select an option

  • Save Kentzo/514947 to your computer and use it in GitHub Desktop.

Select an option

Save Kentzo/514947 to your computer and use it in GitHub Desktop.
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
/*
...
*/
//use a custom runloop
static NSString *runLoopMode = @"com.me.myloop";
[connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:runLoopMode];
[connection start];
while (![connectionDelegate isDone] && ![self isCancelled]) {
[[NSRunLoop currentRunLoop] runMode:runLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.3f]];
}
if ([self isCancelled]) {}
else {}
[pool release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment