views:

267

answers:

3

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?

+1  A: 

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

Matt Poush
+1  A: 

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

Henrik P. Hessel
+1  A: 

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.

PeanutPower