I'm currently开发者_开发知识库 developing an iOS app and have reached the point where I need to implement a server backend in order to support the core functionality. Essentially, the app deals with text strings that need to be uploaded to a server. After receiving the strings, I need the server to perform some tasks with it and then send the result of the tasks (also string-based) back to the iPhone app.
I have zero server experience and am need of some advisement as to where I should begin with this. In order to avoid financial risk, I am attempting to avoid dedicated hosting at initial launch, and so I was wondering if at-home server hosting would be at all possible for the launch and then, if the server-side component was developed appropriately, simply transfer the software to a more permanent dedicated solution if the app's usage warranted.
I have done some research and I have found Amazon S3 to be a popular iPhone app server solution due to its integration with the also popular wrapper, ASIHTTPRequest. This seems to be a more permanent hosting solution, however. In the meantime, for local app testing on a smaller scale, what would the recommended server platform be? Something along the lines of ubuntu with LAMP installed? If so, would the scripts developed on the local platform (I'm assuming in PHP) be directly transferrable to a larger-scale server for the most part?
I would go with shared hosting: http://webfaction.com or http://linode.com. It's unlikely that you're going to have so much traffic that your shared host will not be able to tolerate it. I run a few high traffic apps on Webfaction without difficulty.
From your description of the functionality in your app, it doesn't seem too complicated, and wouldn't be difficult to scale.
PHP development environment on OS X:
OS X has PHP and Apache already installed. It just needs to be enabled, this page describes the process to get it going:
http://foundationphp.com/tutorials/php_leopard.php
Alternatively you can install a package like MAMP ( http://www.mamp.info/en/index.html ), which will provide you with a full stack. (And is what I would recommend.)
The code:
As for the code, you'll more than likely use ASIHttpRequest to do a POST request to URI on your server. The script at the URI will connect to the database, store the string, and then disconnect from the database.
Less than 10 lines of code.
精彩评论