Re: NSURLRequest and NSOperationQueue
Re: NSURLRequest and NSOperationQueue
- Subject: Re: NSURLRequest and NSOperationQueue
- From: "J. Scott Tury" <email@hidden>
- Date: Sun, 17 Jan 2010 14:55:18 -0500
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