christianleroy
christianleroy

Reputation: 1104

Load data from a MySQL database to an Objective C/XCode Project

I have a simple question to XCode/iOS developers out there. I just want to know what are the most basic ways of fetching/inserting data into a MySQL database from an Objective C/XCode program. Basically, what I am planning to do is to create a mobile application version of the website I am currently developing. In short, the XCode program I'm planning to do is a way smaller version of a PHP web application. The XCode program will be able to modify, insert, and fetch data from the database of the website.

Can you guys give me a hint? A tutorial (or links)? I'm not even a new XCode developer, I'm only about to begin being one for the capstone project I am developing with my group (I'm in college, if this info is even necessary LOL).

Upvotes: 0

Views: 2852

Answers (2)

user529543
user529543

Reputation:

I would use REST webservice:

Write a piece of code with XCode which do HTTP GET and HTTP Post to your server. Query data with GET and Insert Update delete with POST.

After this write your server side code in PHP , Java, whatever you know / like to receive those 4 operations, connect to database and send a result you.

This architecture is used in many mobile applications. Has some Pro and so Cons, like everthing.

The Pro: separated code connection to database, separated units => improved security. Probably you don't want everybody see your mysql root password... who can decompile the iPhone app. With separated client-server: it allowed multiple connections, caching.

The list is very long here.

The cons: Probably need to know 1 more developing language than Objective -C Need web hosting, not only database hosting

The list is a lot shorter here and less important.

Upvotes: 0

samir
samir

Reputation: 4551

You should do :

  1. Implement a sever API (Web Services) with your preferred language ( PHP,...) that can communicates with the Data base.

  2. An objective C client ( iOS application) that communicates with the data base but using your API ( Web Services).

here are excellent tutorials that will show you how to do all the steps. Tutorial

Upvotes: 1

Related Questions