• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Now URL connection delegate isn't called at all
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Now URL connection delegate isn't called at all


  • Subject: Now URL connection delegate isn't called at all
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 21 Mar 2012 15:23:13 -0700

Getting further into testing my NSOperationQueue-ified code on iOS (after working around the problem I reported earlier today), I’m finding that the NSURLConnection delegate methods are not being called at all. Ever. Which is kind of a showstopper, and I’ve run out of ideas for debugging/troubleshooting, since there isn’t much visibility into what CFNetwork is doing behind the scenes. To recap:

I’ve created a global NSOperationQueue to serialize access to the code that runs TouchDB, a NoSQL database, since the code is not thread-safe.
This code ends up starting asynchronous NSURLConnections to communicate with other servers. I’m setting the connection’s queue to my queue so the delegate methods will still be called:
    _connection = [[NSURLConnection alloc] initWithRequest: _request delegate: self
                                          startImmediately: NO];
    [_connection setDelegateQueue: [NSOperationQueue currentQueue]];
    [_connection start];
Yes, I’ve verified that +currentQueue returns my queue, since it’s being invoked from it.
On Mac OS X 10.7.3, everything is working fine.
On iOS 5.1, the connection object is created and started, but no delegate method ever gets called, nor does the connection ever get cancelled or released. So something is Very Wrong Indeed.
The rest of the app is running fine; the main thread is alive and handling events. The internal CFNetwork thread is idle. All other threads are idle, and I can’t find any thread associated with my queue. The queue object is still around, and has no operations queued in it.

Any ideas? I’d hate to have to back out all of this refactoring and go back to messing around on the CFNetwork thread, but if I can’t make this work on iOS I’m going to have to do just that.

—Jens

 _______________________________________________
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

  • Follow-Ups:
    • Re: Now URL connection delegate isn't called at all
      • From: "Van Tol, Ladd" <email@hidden>
    • Re: Now URL connection delegate isn't called at all
      • From: Steve Sisak <email@hidden>
  • Prev by Date: iOS deadlocks calling queue-based URL connection delegate
  • Next by Date: Re: iOS deadlocks calling queue-based URL connection delegate
  • Previous by thread: Re: iOS deadlocks calling queue-based URL connection delegate
  • Next by thread: Re: Now URL connection delegate isn't called at all
  • Index(es):
    • Date
    • Thread