简体   繁体   English

iPhone应用程序与网站互动

[英]iphone app to interact with website

Please forgive this simplistic iphone development question. 请原谅这个简单的iphone开发问题。 I have written a web application in PHP and perl using a MySQL backend. 我已经使用MySQL后端在PHP和Perl中编写了一个Web应用程序。 The users log in with a username and password, and then are able to navigate around the site looking at there respective data. 用户使用用户名和密码登录,然后能够浏览站点并查看各自的数据。

I have decided to begin developing an iPhone app which will interact with the server (Linux Redhat that I have full control over). 我决定开始开发将与服务器交互的iPhone应用程序(我完全控制Linux Redhat)。 Now I know this is possible and I'm sure there are many tutorials out there to help so I am not asking for a 'how-to' here. 现在,我知道这是可能的,并且我确定有很多教程可以帮助您,因此我在这里不要求“如何做”。 What I would like to know is what should be my approach ie where do I start?? 我想知道的是我应该采取什么方法,即我应该从哪里开始? Some questions... 一些问题...

1) Should I be using a web service installed on my server, and if so which one? 1)我应该使用服务器上安装的Web服务吗? 2) How should I pass username and password data to the website if not using web service? 2)如果不使用Web服务,应如何将用户名和密码数据传递给网站? 3) How easy is it to send the username/password, and receive any data securely ie HTTPS? 3)发送用户名/密码和安全地接收任何数据(例如HTTPS)有多容易? 4) The old debate of JSON or XML for receiving data +/- sending login details??! 4)关于接收数据+/-发送登录详细信息的JSON或XML的古老争论??!

As I said, I am just looking for ideas/pointers on how to approach this project. 正如我所说,我只是在寻找有关如何进行此项目的想法/指标。

Thanks once again, Andy 再次感谢,安迪

1) It's up to you, you can create a RESTful web service and iPhone application which I personally preferred. 1)由您自己决定,您可以创建一个我个人更喜欢的RESTful Web服务和iPhone应用程序。

for 2),3) see 对于2),3) 参见

4) use JSON, it saves your bandwidth. 4)使用JSON,可以节省您的带宽。

Alternatively you can develop a mobile website using somthing like Sencha Touch or jQuery Mobile and convert it into a native application 另外,您也可以使用Sencha Touch或jQuery Mobile之类的工具开发移动网站,并将其转换为本地应用程序

If you use JSON, dont forget to write some robust validation code to cope with malicious requests. 如果您使用JSON,请不要忘记编写一些可靠的验证代码来应对恶意请求。 The advantage of using XML is that you can use a validating parser and write a schema for all your documents, which can save you a lot of time and make your application more resilient to malformed requests. 使用XML的优势在于,您可以使用验证解析器并为所有文档编写模式,这可以节省大量时间,并使您的应用程序更能应对格式错误的请求。

I recommend you use a REST Web service over HTTPS, it makes things so much simpler. 我建议您通过HTTPS使用REST Web服务,它使事情变得更加简单。

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

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