Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

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.