JasonDavis
JasonDavis

Reputation: 48933

How to make my server work with an iPhone app?

I am working on a social network project in PHP/MySQL. If you have ever seen or used the myspace or facebook iPhone app you will see what my question is all about. I am curious what most iphone apps do with the server for a social network type iphone app. I was tyhinking possibly it uses a REST server with jSON or XML output and possibly the iphone app will just read that? Or does most iphone apps do there own query to a database somehow? Sorry I really don't have any knowledge in that sort of programming so I could be way off on all this.

So basicly what would be the most efficient way for a iphone app to get data from a server?

Upvotes: 1

Views: 1118

Answers (3)

acheo
acheo

Reputation: 3126

You would use JSON or XML web services but you can use whatever HTTP mechanism you like.

Answering the second part of your question no the apps don't normally talk direct to the database but use web services instead.

Upvotes: 1

Matt Poush
Matt Poush

Reputation: 1265

A RESTful approach is almost certainly the cleanest and easiest. The iPhone API has great support for communicating via XML.

There are some fairly comprehensive examples in Apple's Developer Connection.

http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/XMLParsing/XMLParsing.html

Upvotes: 1

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36617

In my opionion, the ASIHTTPRequest Library, a RESTful Webservice and the JSONTouch library are working great together.

To get you started (including a PHP/MySQL example) take a look at this great tutorial:

iPhone Coding Tutorial – Creating an Online Leaderboard For Your Games

Upvotes: 1

Related Questions