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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-07-2010, 12:31 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 13
axiixc is on a distinguished road
Default Where to put network intensive code

So I have an app that pulls in an RSS feed and parses it. It then displays this in the second tab of a UITabView controller. Trouble is, it takes about ~5-20 secs to pull the RSS and when I've put the code in viewDidLoad, viewDidAppear, and awakeFromNib it has either waited to pull the RSS while the app launched, or before the new view would appear in the tab bar.

What I would like to happen is have the app launch and it start pulling the RSS but not at the expense of startup time, or at least have it start when the tab is selected (but again, the view needs to appear, it can't lock up while it pulls the rss). Is there some method I should be placing it in besides these, or some other way. Thank you!
axiixc is offline   Reply With Quote
Old 02-07-2010, 01:41 AM   #2 (permalink)
Registered Member
 
msencenb's Avatar
 
Join Date: May 2009
Location: Stanford, CA
Posts: 291
msencenb is on a distinguished road
Default

Well I suppose you could look into NSThread...

Do you know much about threads? It wouldn't be too hard to implement if you are only using one extra thread to pull the RSS with no shared data... but be careful when you are accessing data between the main thread and the new thread... could run into race conditions, deadlocks, etc.

If you don't want to deal with threads... you could just have a UIActivityIndicator display while the RSS downloads data to indicate to the user that the app is doing something and didn't just lock up on them.

Hope this helps!
__________________
I'm starting a new blog dedicated to iOS development. Check it out at:

http://www.iosdevscreencasts.com
msencenb is offline   Reply With Quote
Old 02-07-2010, 12:44 PM   #3 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 13
axiixc is on a distinguished road
Default

Quote:
Originally Posted by msencenb View Post
Well I suppose you could look into NSThread...

Do you know much about threads? It wouldn't be too hard to implement if you are only using one extra thread to pull the RSS with no shared data... but be careful when you are accessing data between the main thread and the new thread... could run into race conditions, deadlocks, etc.

If you don't want to deal with threads... you could just have a UIActivityIndicator display while the RSS downloads data to indicate to the user that the app is doing something and didn't just lock up on them.

Hope this helps!
Using NSThread at the moment, seems to be working. Thanks.
axiixc is offline   Reply With Quote
Old 02-07-2010, 12:51 PM   #4 (permalink)
Obj-C Learner
 
Join Date: Apr 2009
Location: Manchester, UK
Posts: 1,030
ZunePod is on a distinguished road
Send a message via MSN to ZunePod Send a message via Yahoo to ZunePod
Default

Are you testing this on device?
ZunePod is offline   Reply With Quote
Old 02-07-2010, 12:54 PM   #5 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 13
axiixc is on a distinguished road
Default

Quote:
Originally Posted by ZunePod View Post
Are you testing this on device?
Yes, iPod Touch 2nd Gen
axiixc is offline   Reply With Quote
Reply

Bookmarks

Tags
nsxmlparser, uitabbar, uiviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 320
6 members and 314 guests
2Apps1Day, akacaj, SLIC, soohyun, Techgirl-52, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,115
Posts: 402,887
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:06 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0