Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Connecting a website with an iOS app

Hello all,

I want to know if I can connect an iOS app with a website? For example, if I had a website that provides live sports scores or updates and I wanted this to display this on an app, how would I go about doing this? So, if I had 'team A' vs 'team B' and the score was 1 - 0 and I had a view controller that displayed different matches how could I store this information on my app and then display it on the view controller? Then every time there was a new match the view controller updates and displays a new match as the website is updated. As a start would I go about using the NSURL Class or not?

Thanks in advance.

2 Answers

The website is storing the information in a database and the best way to provide this information to your iOS app is to connect to the database to access the same information.

So what class or method would I use to do this? Could you point me in the right direction in terms of docs or tutorials I could follow? Thanks.

1) By storing you mean persisting... right? You may want to look into Core Data or other persistence techniques like NSUserDefaults or caching.

2) You could have a method that runs in the background that retrieves data pushed from a server with score updates. You could then sync the UI with the latest data after the information has been successfully pulled.