iPhone创建聊天应用程序 [英] IPhone creating a chat application

查看:68
本文介绍了iPhone创建聊天应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iPhone上创建一个聊天类的应用程序。我知道我将如何实现轮询模型,在该模型中,iphone会轮询服务器以查看是否有任何消息到达,如果有则可以将其检索并显示给用户。但是,我更感兴趣于推送模型,在该模型中,服务器将新消息推送到iphone,并将其显示给用户。我很难弄清的部分是如何在电话上建立一些永久性的连接,以侦听传入的消息...任何建议或评论都会得到应用。

I want to create a chat sort of application on the iphone. I know how I would go about implementing a poll model, where the iphone would poll the server to see if any messages have arrived and if they have it can retrieve them and show them to the user. However im more intersted in a push model, where the server pushes new messages to the iphone and it displays it to the user. The part im having a hard time figuring out is how to go about opening some permanent connection on the phone that will listen for incoming messages...Any suggestions or comments would be appriciated..

谢谢

丹尼尔

推荐答案

iPhone 3 SDK具有内置的推送支持。基本上,所有需要推送的消息(来自所有应用程序)都发送到Apple的服务器,该服务器维护与用户iphone的持久连接。好处是您不必担心它,即使您的应用未运行(例如从主屏幕),它也可以获取更新。缺点是您的数据必须通过Apple的服务器。

The iPhone 3 SDK has push support built in. Basically, all messages that need to be pushed (from all apps) go to Apple's server, which maintains a persistent connection to the user's iphone. The upside is that you dont have to worry about it and your app can get updates even when its not running (so like, from the home screen). The downside is that your data has to go through Apple's server.

这篇关于iPhone创建聊天应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆