简体   繁体   English

为iPhone应用程序托管Web服务

[英]Hosting a web service for an iPhone App

I need to write a fairly simple Delivery Tracking application. 我需要编写一个相当简单的交付跟踪应用程序。 The device needs to know information about the 'matters' such as status (delivered/awaiting delivery), type (for delivery/for pickup), address, payment accepted etc. 设备需要了解有关“事项”的信息,例如状态(已交付/正在等待交付),类型(用于交付/用于提货),地址,已接受付款等。

The iPhone part of the app seems very simple but in terms of hosting some kind of web service is the part I am unsure about. 该应用程序的iPhone部分看起来非常简单,但就托管某种Web服务而言,我不确定。

Does Apple have some kind of service or recommending way of handling this? 苹果是否提供某种服务或推荐的处理方式?

The web service would need to store all the information about the matters and receive updates from the device when matters are delivered and then there is a possibility that new matters could be sent out manually from the depot. Web服务将需要存储有关事项的所有信息,并在事项交付时从设备接收更新,然后可能会从仓库手动发送新的事项。

These are the parts I am unsure about - any ideas? 这些是我不确定的部分-有什么想法吗?

There is no Apple recommended way or service. 没有Apple推荐的方式或服务。 For a similar system to the one you are proposing I have a Ruby On Rails (http://rubyonrails.org/) backend application with MySQL database hosted by a third party. 对于与您提出的系统类似的系统,我有一个Ruby On Rails(http://rubyonrails.org/)后端应用程序,该数据库由第三方托管MySQL数据库。 It took me a couple of weeks starting from no knowledge of RoR to get the Rails App and database up and running. 从不了解RoR开始,我花了几周的时间来启动并运行Rails App和数据库。 I recommend Appress's Beginning Rails 3 as a good book to start with. 我推荐Appress的Beginning Rails 3作为一本好书。 You can develop and run Ruby On Rails on MacOSX and easily port your app to a Linux server when it sufficiently developed. 您可以在MacOSX上开发和运行Ruby On Rails,并在应用程序充分开发后轻松将其移植到Linux服务器。

There are other web-services frameworks such as PHP or ASP.NET which you could use so long as they return data in the form of JSON or XML. 您还可以使用其他Web服务框架(例如PHP或ASP.NET),只要它们以JSON或XML形式返回数据即可。

The Ruby on Rails app can render JSON or XML when the iPhone app sends a request via NSURLRequest. 当iPhone应用程序通过NSURLRequest发送请求时,Ruby on Rails应用程序可以呈现JSON或XML。 I'm using Objective Resource (http://iphoneonrails.com/) which takes care of a lot of work connecting to RoR backend but you can use the many open source JSON frameworks such as TouchJSON (http://github.com/schwa/TouchJSON) or use NSXMLParser, an Apple Objective-C class, if your request returns in the form of XML. 我使用的是Objective Resource(http://iphoneonrails.com/),它负责连接到RoR后端的大量工作,但是您可以使用许多开源的JSON框架,例如TouchJSON(http://github.com/ schwa / TouchJSON)或使用NSXMLParser(Apple Objective-C类)(如果您的请求以XML形式返回)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM