在iPhone(也是Android)和服务器之间同步联系人 [英] sync Contacts between iPhone(also Android) and server
问题描述
我遇到了麻烦,需要您的帮助.
I am in trouble and Need your help.
第一个问题:
我的IOS应用程序必须向Web服务器发送数据或从Web服务器接收数据. 使用TCP定义的服务器,数据格式为TLV;我以前从未使用过TLV,也不知道如何解决此问题.
My IOS app has to send/receive datas to/from a Web Server. The server defined using the TCP and the data format is TLV; I have never used TLV before, and have no idea how to solve this problem.
对于TCP,我决定使用cocoaAsyncSocket,它很容易处理TCP传输. 但是我以(NSData *)格式发送/接收所有数据,我不知道服务器是否可以解码 它正确.
As for TCP, I decide to use cocoaAsyncSocket, it's simple to deal with TCP transports; But I send/receive datas all in the (NSData*) format, I don't know if the server can decode it correctly.
第二个问题:
我还试图在本地客户端和服务器之间同步联系人;本地客户端将是IOS应用程序和Android应用程序.通过我决定使用vCard作为联系人的数据格式,但是iPhone的vCard包含Android中不包含的某些项(例如RelatedName);当我使用vCard时,会有一些数据丢失,我无法解决此问题.有什么好的建议吗?
I am also trying to sync Contacts between local client and the server; the local client will be IOS app and Android app. Through I decide using vCard as the contacts' data format, but the vCard from iPhone contains some items(such as RelatedName) that not contained in Android; When I using vCard, there are some data lose, I can't solve this problem. Is there any good suggestion?
有人帮助我.最好的问候.
Somebody help me. Best regards.
=======================
=========================
最后,我决定使用cocoaAsyncScoket来传输数据,并使用SQLite来存储联系人的所有数据.看来避免数据丢失是不可能的.
Finally, I decided to use cocoaAsyncScoket for transporting data and use SQLite for storing contacts's all data; And it seems avoiding data lose is not possible.
推荐答案
我完成了它.
我使用GCDAsyncSocket库发送&接收数据; 对于TLV,只需按照自定义定义的规则按顺序发送原始字节即可.
I used the GCDAsyncSocket lib to send & receive datas; As for TLV, just send the raw bytes in order under the custom defined rules will be fine.
这篇关于在iPhone(也是Android)和服务器之间同步联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!