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

iOS

How to connect iOS App to database?

Hey there,

I'm working on a timetable app for my own school. To get it run I need to know how to connect the app to my timetable database. I haven't found courses regarding this topic here and on Google, I just found a few that were way to complex.

I'd be very thankful for some references to not very difficult tutorials or for a reference to a course here on treehouse.

Have a great day,

Bruce.

1 Answer

Hi, check out this blog post: http://codewithchris.com/iphone-app-connect-to-mysql-database/

Hope it helps :)

Thanks!

Is there an updated tutorial?

It's great, but the code seems to be written in Swift 2 and causes a ton of errors and if I try to fix them it does even more errors.

@Bruce Röttgers I can try to find one, however, working through the code inconsistencies will actually help you learn and retain the information better. You can read the changes from Swift 2 to 3 here: https://swift.org/migration-guide/

They are mostly class naming changes, e.g ErrorType is now Error, these can be referenced from apples developer suite page: https://developer.apple.com

Otherwise, this is a valuable subject, and I think its quite likely Treehouse will add a course sometime in the near future. :)

Can you help me out here?

    var session: URLSession!

    let configuration = URLSessionConfiguration.default

    session = URLSession(session: configuration, dataTask: self, didReceiveData: nil)

It says as error: "Can't convert value of type URLSessionConfiguration to expected argument type URLSession" I first tried to solve this by changing session to type URLSessionConfiguration, but it needs to be URLSession for other things later in code