Re: NSURLConnection from inside -[NSManagedObjectContext performBlock:]?
Re: NSURLConnection from inside -[NSManagedObjectContext performBlock:]?
- Subject: Re: NSURLConnection from inside -[NSManagedObjectContext performBlock:]?
- From: Laurent Daudelin <email@hidden>
- Date: Mon, 18 Nov 2013 21:41:48 -0500
Most likely it doesn’t have a runloop.
Have you tried scheduleInRunLoop:forMode:?
-Laurent.
-- Laurent Daudelin
I think I'm starting to understand what I'm doing wrong here…
I seem to be having trouble calling making an NSURLConnection inside a call to -[NSManagedObjectContext performBlock:]. I can set it up, but my delegate never gets called back.
I create the NSURLConnection with:
conn = [[...] initWithRequest:req delegate: del startImmediately: NO];
and then, after setting up a few things, I call
[conn start];
The docs say start will schedule the connection in the "default" modes. The MOC's run loop mode is nil. Is this why it's not getting called back? What's the right thing to do here?
The nice thing about scheduling it on the MOC is that the callbacks happen in the MOC. But maybe -[NSMOC performBlock:] does more than just dispatch the block to the MOC's queue.
I just went to see if I could use setDelegateQueue: on the connection, realizing two things: 1) It's an NSOperationQueue, not a dispatch queue, and 2) I can't get at either for an NSMOC, so it looks like I really can't start a connection from inside -[NSMOC performBlock:].
Am I right about this?
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden