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 <st...@mac.com> 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 (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/cts3e1%40gmail.com
>
> This email sent to cts...@gmail.com
>
_______________________________________________

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