Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-09-2008, 04: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
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Online Users: 277
22 members and 255 guests
aderrington, Alexman, AlexTheMighty, arcturus, Bertrand21, Cathy, Chilibird, Corund, evana, Falcon80, fanstarmike, Glnn, headkaze, iSdkDev, jhaynie, kalygraphix, mac514, pereorra, shuvo1879, Slecorne, smrtital, tlikyu
Most users ever online was 779, 05-11-2009 at 09:55 AM.
» Stats
Members: 24,228
Threads: 39,008
Posts: 171,099
Top Poster: smasher (2,570)
Welcome to our newest member, SSL Matrix
Powered by vBadvanced CMPS v3.1.0

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