문제

I've got an Objective-C/cocoa based application that I'm working on. This app is client<->server. Currently, the communcation protocol is based upon some fairly simple XML. While XML works for this task, it is not ideal in any aspect. It's a pain to serialize data to XML, it's not particularly light-weight, and difficult to incorporate non-data information (such as: 'do this next') in.

I'm looking for suggestions to an alternative.

I've considered some of the ones listed here, but haven't decided on any. Suggestions?

도움이 되었습니까?

해결책

I'm using JSON for an iphone application - I typically would prefer XML, but we needed it very lightweight, so we decided on JSON.

If your working with XML, you should take a look at XPath if you've not already - it will give you tremendous power for extracting values from a XML data structure.

다른 팁

If you are talking to a Objective-C server you can look into encoding and decoding with the preferred serialization methods available in Objective-C.

NSKeyedArchiver and NSKeyedUnarchiver

Basically you will get an NSData from the NSKeyedArchiver that you will send (bytes/length) to the other part and there place it back into an NSData and use NSKeyedUnarchiver to unpack it into objects again.

What kind of server do you have? If the server is java based I'd recommend looking at HessianKit by Fredrik Olsson. Encode/Decode to ordinary Objective-C types and put in NSArrays and NSDictionaries will make the experience smoother.

What's wrong with (Portable) Distributed Objects?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top