How Do I create a synchronous version of NSURLConnection
Posted
by
quinn
on Stack Overflow
See other posts from Stack Overflow
or by quinn
Published on 2012-03-25T23:00:55Z
Indexed on
2012/03/25
23:29 UTC
Read the original article
Hit count: 280
I am using NSURLConnection
inside of an NSIncrementalStore
to synchronize my NSManagedObject
with rest based web service built in Rails. I am aware of +sendSynchronousRequest:returningResponse:error
but my understanding is that will not allow me to access such things as the HTTP response status code which I will need to properly handle the response, my understanding is sendSynchronousRequest returns the data if it responds in the 200 range and fails if it doesn't and doesn't really give you much more than that. I'm assuming I will somehow have to block the current method call after the NSURLConnection
is instantiated and unblock it after NSURLConnection
's delegate sets some value that can be returned by the blocked method. I'm assuming this will involve some combination of NSLock and NSThread but I really don't know where to start with this, any help will be greatly appreciated, thank you.
© Stack Overflow or respective owner