Re: NSURLRequest and NSOperationQueue
Re: NSURLRequest and NSOperationQueue
- Subject: Re: NSURLRequest and NSOperationQueue
- From: Clint Shryock <email@hidden>
- Date: Mon, 18 Jan 2010 10:37:49 -0600
I had the same issue in the past using NSOperationQueue and NSURLConnection,
and I resolved it by simply telling NSURLConnection to send using
synchronously using sendSynchronousRequest:returningResponse:error:
Would that not take care of the issue?
+Clint
On Sun, Jan 17, 2010 at 1:55 PM, J. Scott Tury <email@hidden> wrote:
> The issue that Dave has run into is that when you call the asynchronous
> NSURLConnection call, NSURLConnection looks to see what thread you are
> calling it on, and it will only call your delegate back on that Thread (if
> it exists). If you exit your NSOperation main method, your thread is going
> to be cleaned up, and you will never get the delegate callbacks you want.
>
> Re-reading Dave's original email, I think what's probably happening to him
> is that he may be switching the runLoops of ht eNSURLConnection BEFORE it
> has actually started. Here's the comment from the documentation:
>
> You may call these methods after the connection has started. However, if
> the connection is scheduled on multiple threads or if you are not calling
> these methods from the thread where the connection is scheduled, there is a
> race between these methods and the delivery of delegate methods on the other
> threads. The caller must either be prepared for additional delegation
> messages on the other threads, or must halt the run loops on the other
> threads before calling these methods to guarantee that no further callbacks
> will occur.
>
> Scott
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden