开发者

Using plist as exchange format

currently I am planning an iPhone app for a client which should be able to exchange data with a server, for which a server application is to be developed, too.

The data in question can be compared to contact data, on most platforms xml would be propably the exchange format of choice. iOS supports (comfortable) writing of xml only via 3rd party libraries, which is why I was thinking about using plist as exchange format. The connection to dictionaries w开发者_如何学Could make things quite easy for me.

However, future releases targeted at non iOS / mac platforms are to be taken into consideration too, so I need to know whether plists can be easily read on other platforms.

So, my questions are:

  • Are plist's an apple format only or are they common to multiple platforms?
  • if apple exclusive: Are there libraries which allow easy reading of plists on other platforms, like there are xml libraries for iOS?

Thanks alot, guys!


Plist is an Apple thing. I'm sure there are parsers written for other devices but not natively as with iPhone. Personally I like JSON for sending portable data between different platforms.

JSON-parser for iPhone: http://code.google.com/p/json-framework/


as far as i know .plist are xml files... just try to rename an info.plist file from a iPhone project with .xml extension and open it in textEdit or other xml editor (or just open the .plist file without renaming it)... the first line in a .plist file is:

<?xml version="1.0" encoding="UTF-8"?>

...so, just edit a .plist file in xCode and eventually rename it for other platform...


However, future releases targeted at non iOS / mac platforms are to be taken into consideration too, so I need to know whether plists can be easily read on other platforms.

My advice would be to just use JSON or XML.

You could probably write a binary plist reader for other platforms (using Apple's Darwin open source project and its plutil application for starting code) but binary formats on various platforms introduce their own issues (big vs small endian, etc.).

Also, a number of server-client data exchange frameworks already use JSON and XML as intermediate data formats. These existing standards will probably make updates and feature enhancements easier for both you and for your client.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜