Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-09-2008, 05:48 PM   #3 (permalink)
kelvin
New Member
 
Join Date: Dec 2008
Location: Hawaii
Posts: 1
Default synchronously using NSURLConnection's asynchronous delegate methods

There is a way to use NSURLConnection's delegate methods synchronously. However, unless you know about how NSRunLoop works, it's not quite straightforward.

In general, you'll want to create the NSURLConnection and _not_ have it start immediately. Instead, you should schedule NSURLConnection to run in its own run mode in the current NSRunLoop, then start the connection. You should then spin the run mode in the current NSRunLoop until the delegate method flags that the connection has finished loading (or failed loading). After which, you can continue on w/ the rest of your application.

If you want code and a more complete description, there's a blog post about it here:
Using NSURLConnection Synchronously via Asynchronous Delegates | stackq

-Kelvin
kelvin is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,690
Threads: 89,161
Posts: 380,410
Top Poster: BrianSlick (7,110)
Welcome to our newest member, hudsonas4
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:36 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.