0

New to iPhone dev here. Just wondering what's the best way to connect an iPhone app frontend (based on Cocoa) to a php/MySql based backend?

The iPhone application will frequently access and change data stored on our server.

Many thanks

tyng
  • 33
  • 1
  • 6
  • possible duplicate of [How to connect to a MySQL database from an iPhone?](http://stackoverflow.com/questions/468618/how-to-connect-to-a-mysql-database-from-an-iphone) – Brad Larson Oct 29 '10 at 17:11

1 Answers1

7

You will need to create a web service that will expose a set of APIs that are then use by your iPhone app to push/pull data. You may then choose to cache the data locally (on the iPhone) in a sqlite3 database. The most common data transfer formats are JSON and XML.

Paul Ardeleanu
  • 6,620
  • 2
  • 40
  • 41
  • Further to your answer here is link to JSON library for iPhone: http://stackoverflow.com/questions/4025349/is-there-an-3rd-party-library-for-parsing-json-on-the-iphone/4025379#4025379 – Alex Rashkov Oct 29 '10 at 13:02
  • For a discussion on the best JSON library see: http://stackoverflow.com/questions/286087/best-json-library-to-use-when-developing-an-iphone-application . I use json-framework. – Paul Ardeleanu Oct 29 '10 at 13:13
  • Thanks guys, any resources for XML? (for comparison) – tyng Oct 29 '10 at 13:31
  • There is TouchXML (part of the touchcode project). http://github.com/schwa/TouchCode – Paul Ardeleanu Oct 29 '10 at 13:48
  • If you're creating something from scratch anyway, I'd go with JSON, it's much faster to transfer and parse. Binary plists are also awesome :) – runmad Oct 29 '10 at 14:35
  • Thanks for all your comments guys, will get into JSON pretty soon. – tyng Oct 29 '10 at 14:47