2

I'd like to send serialized objects between a C++ application (running on a linux machine) and an iPhone application. Is this possible?

Is there a way to encode/decode data using the NSCoding protocol on the C++ side? Has someone reverse engineered this protocol?

jonas
  • 143
  • 1
  • 9
  • NSCoding is just an Objective-C protocol. Did you mean NSKeyedArchiver and NSKeyedUnarchiver? Not sure but I think those are included in GNUstep which you can use with Objective-C++ (a superset of C++ similar to Objective-C). –  Sep 06 '11 at 21:34
  • Also, files archived with NSKeyedArchiver are just binary property lists. You can examine them with Property List Editor or Xcode. –  Sep 06 '11 at 21:36
  • Yes, what I'd like is a C++ equivalent of NSKeyedArchiver/NSKeyedUnarchiver. Does this exist? – jonas Sep 06 '11 at 21:42

2 Answers2

2

I couldn't find any techniques to decode objects in C++ that had been serialized using the NSCoder protocol.

I ended up building a JSON interface on both sides and simply sending my objects back and forth as serialized text.

Thanks for the responses and ideas!

jonas
  • 143
  • 1
  • 9
0

I'm no expert, but it seems like your best bet is to use property lists, which allow you to serialize objects into a device-independent format. You may still need to write some custom deserialization code on the C++ side, however. But this seems easier than trying to decode archived objects.

Check this out for more details: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Archiving/Articles/serializations.html#//apple_ref/doc/uid/20000947-BCIEBEGI

acjay
  • 34,571
  • 6
  • 57
  • 100