Testing from iOS app through PHP API to database - php

I am developing an iOS app, which stores data that the user enters in the app through an API written in PHP (using the Yii framework) in a database on a server. It works, however, I don't have any test code. I am looking into the best way to test this kind of program stack, but I cannot see the wood for the trees.
For unit testing the PHP API, I am looking into PHPUnit, which seems
to be the de facto standard for PHP. Is there a standard for unit
testing iOS code?
What would be the best way to create an
integration test case, in which I specify certain behavior in the
app, and check if the data ends up correctly in the database?

Related

Build webservice for both website and app

I've developed an android app that interact with my database by using some php scripts (one for each function of my app) that returns a json object with response data.
Now i need to build up a website too that do the same tasks of my app, but i would fix up my server code.
Should i have to maintain my app php scripts separate from website scripts (i'm planning to use some php framework to develop it), or there's a different way to do it?
No! Same script will work for all platforms.
If you follow proper protocols you will be good :)
Use Rest Console or similar tools to test your webservice on browser.
If you are able to get JSON response, then its good for all platform.
If you want to separate out the platforms and devices on server that can be handled by using user agent check at server end.

Sharing code between a Web Applicationa and an iPhone App

I posted this question a few weeks ago, but perhaps it came off as vague and wasn't really well accepted. So I'm going to try and be more specific, since I am still looking for an answer.
I have an idea for an iphone app that I wanted to start working on. I'm a Web Programmer by trade, and was considering writing the application initially as a website. (intended for Desktop / Laptop users). Once I figured out all the ideas, I was then going to use that as a blueprint for the iphone app.
My question is: It would be great to have both versions running, and thus, sharing as much code as possible. Is there a practice, methodology, or set of principals for dealing with this sort of scenario? For Example: www.facebook.com and the Facebook iPhone app.
I'm thinking that the endpoints which the iPhone accesses to retrieve data, should be the same code that the Web Application uses to retrieve data. Or with different platforms running, is it common practice to maintain completely separate code bases?
To be clear, my iPhone App would be a native iPhone app.
thoughts?
you can create a webservice for that,you can use json or xml to create webservice response format.
you can use that webservice with any platform. by parsing json or xml you can get your data and display it according to your platform specific design.

Migrating PHP web app to iOS

So I've built a web app in PHP that relies heavily on a MySQL database. Now (for user convenience purposes) I'm trying to create the exact same app, just as an iPhone app. Granted, I have no knowledge of Objective-C (just starting to learn it), I wanted to know how to go about this. I know that I'll have to use some kind of intermediary to get Objective-C to connect to the SQL database.
So essentially my questions are: If I've already created the web app as aforementioned, could I use the same DB and tables for the iOS app version as I did for the PHP web version? Also, is there anyway to migrate any code I've created in PHP to iOS (I realize that they are two completely different languages), but I'm just curious as to whether or not I'll have to build the iOS app from 'complete' scratch.
Your best bet is to write an PHP service to talk to your database.
This way you can share this API between your app or iOS app or any other type of client app.
The service will be responsible to receive request query the database and send responses in JSON format for example.
So to make things easier, you should not query the database directly from your apps, use a common web service.
You can use your MySQL database for any purpose because it is just data. The code that will show them will be different though. If you have no knowledge about Objective-C you should consider the web-app approach.
Here are a few helper links.
https://developer.apple.com/library/safari/referencelibrary/gettingstarted/gs_iphonewebapp/_index.html
http://gigaom.com/2010/02/12/how-to-create-an-iphone-web-app/

Writing a PHP API and an Android app

I have a shop project written with Zend Framework 2 and now I want to write an app for this project. I'm new to this whole Android thing (I wrote a few test apps, but no big project like this). So at this moment I'm planning the "app-project" but i didn't find that much till yet.
I have to write the API in PHP and the complete Android app, so I just wanted to ask if someone can show me some good tutorials/sites etc to get more information for this (there are some big topics I'd like to know like security with the JSON communication etc).
If you're building your API in PHP assess first which framework you want to use. I've had success using Yii to build a quick REST JSON API. After getting to grips with Yii this article explains in detail the process of building a REST API: http://www.yiiframework.com/wiki/175/how-to-create-a-rest-api/
You have a few choices in terms of authentication and securing your API. Firstly make sure all data is sent over https otherwise your efforts to secure your API are wasted because anyone listening on your network can read requests/responses in plaintext. Look at using OAuth or a HMAC pattern similar to Amazon web services for authenticating requests. Here's a great article on the latter: http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/

Developing iOS xcode that connects to codeigniter data

I have an existing web app that I have written in CodeIgniter using a MySQL database.
I now want to learn how to develop an iPhone app for the web app.
I have had a look at a lot of tutorials about xcode and iphone development but I have yet to see one about connecting and displaying data from my database.
I have seen the topic of RESTful come up a few times but am unsure if this is the direction I need to go?
If anyone has had success in building an iphone app that connects to a MySQL DB, would they be kind enough to share some tips or tuts on getting started.
I was working in a similar project: http://www.savemeeting.com It consists in an app (iOS, Android and Blackberry) and a Web showing the same information. Basically you need a Web Service (RESTful, XML-RPC, SOAP...) server and a Web Service client in your app.
I recomend you to write a RESTful server, if you use Code Igniter, you can use this library: https://github.com/philsturgeon/codeigniter-restserver and then write the client in your iOS app (sorry, I have no knowledge to guide you in this part).

Categories