Convolution
Convolution

Reputation: 2351

Implement a web service or use scripts for iPhone App interaction?

I'm in the middle of working on my first native application with networking and I have a question regarding the best way for interacting with remote storage. In a perfect world I'd like to do the following.

I've read some similar questions posted, maybe something's lost in translation, but the two most common means I've come across are.

Are there other options? Is one a better implementation over the other? (web services come up more in searches)

Thank you in advance for taking the time to read my question and possibly clearing up any confusion.

Upvotes: 2

Views: 576

Answers (1)

Stefan Arentz
Stefan Arentz

Reputation: 34945

Whoa! Web Services! Oh wait, calling a PHP script that returns JSON is actually also a web service. Well, that makes things simpler :-)

Yeah, so I would go for this:

  • Write a PHP script that returns JSON data (many tutorials available)
  • Protect the PHP script by setting up 'Basic access authentication' (Apache documentation)
  • Tell Apache to take the user database from your mysql database
  • Run your service on secure (HTTPS) web server (important because basic auth is not secure)

This way you can use almost all standard components on the iPhone side. NSURLConnection will talk HTTP(S) and there are excellent open source JSON parsers for Objective-C.

Upvotes: 2

Related Questions