Created
February 24, 2009 20:26
-
-
Save vickeryj/69762 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConnectionDelegate *connectionDelegate = [[[ConnectionDelegate alloc] init] autorelease]; | |
NSURLConnection *connection = [[[NSURLConnection alloc] initWithRequest:request delegate:connectionDelegate startImmediately:NO] autorelease]; | |
connectionDelegate.connection = connection; | |
NSRunLoop* runLoop = [NSRunLoop mainRunLoop]; | |
[connection unscheduleFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; | |
[connection scheduleInRunLoop:runLoop forMode:NSDefaultRunLoopMode]; | |
[connection start]; | |
while (![connectionDelegate isDone]) { | |
[runLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:.3]]; | |
} | |
Response *resp = [Response responseFrom:(NSHTTPURLResponse *)connectionDelegate.response | |
withBody:connectionDelegate.data | |
andError:connectionDelegate.error]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment