IPhone creating a chat application [closed]

两盒软妹~` 提交于 2019-12-02 04:05:00

问题


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..

Thanks

Daniel


回答1:


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.



来源:https://stackoverflow.com/questions/1375645/iphone-creating-a-chat-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!