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. Prompt the user for login information from the iPhone. Verify the users credentials and connect to a MYSQL database hosted by myself. Parse MYSQL data into a table view. Allow the user to add or update information in the database. I've read some similar questions posted, maybe something's lost in translation, but the two most common means I've come across are. Create a web service for handling these requests using SOAP/REST/JSON (no experience doing this, but would like to learn if it's a better implementation) Write PHP scripts (enough experience to get by) that will grab data username/password/requests securely from my NSURLRequest and echo the NSData as XML and parse it with an NSXMLParser. 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.
-
Answer:
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.
Convolution at Stack Overflow Visit the source
Related Q & A:
- How to deal with timeout when accessing a web service?Best solution by Stack Overflow
- How to call a web service using HttpWebRequest?Best solution by Stack Overflow
- How to call .aspx page from a web web service(service.svc?Best solution by Stack Overflow
- how to consume a web service in mule flow?Best solution by Stack Overflow
- How do I forward gmail raw email to a web service?Best solution by email.about.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.