On Sep 8, 2011, at 2:46 AM, Mike Abdullah wrote:

>> In delegate connectionDidFinishLoading handling as follows:
>> -(void)connectionDidFinishLoading:(NSURLConnection *)connection
>> {
>>      @try {
>>            CFRunLoopStop(m_runLoopRef);
>>            [m_connection release];
>>            m_connection =nil;
>>      }
>> }

Ow. Don’t do this. Stopping the runloop is not the right thing to do. If you 
really want to see how to block till an NSURLConnection finishes, one example 
is this code of mine:
        
https://github.com/couchbaselabs/CouchCocoa/blob/master/REST/RESTOperation.m

Really though, it’s better to write your code to be asynchronous. Writing 
synchronous code and then making it run on a background thread because it 
blocks the UI, is effectively the same result as writing it asynchronously, 
just more complicated and error-prone.

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to