About Cocoa Support in Apache Thrift

If you want to develop a Cocoa/Objective-C application with Thrift support, I should note that there are some limitations in the current version (0.9.0):

Thrift’s protocols describe “what” is transmitted, and transports are the “how”.

  • Only binary protocol is implemented (TBinaryProtocol).
  • TBinaryProtocol creates a binary data which doesn’t have length field. If you want to use Thrift as a serializer only, you should append some bytes which are length of your binary data.
  • You can use TMemoryBuffer as Transport interface to build binary data of your messages in the memory. It returns the binary data of your message with getBuffer() function.

As a binary transport protocol, Google Protocol Buffers is more efficient, but it doesn’t have official support for Objective-C.

Of course, you can use C++ generated sources of Google Protocol Buffers in your Objective-C project, but you have to convert all your files into Objective-C++ files (.mm), and you should mix C++ and Objective-C code which is error prone in my opinion.

The lack of documentation is another problem of Thrift. If you cannot find good resources about Thrift usage, please also check below links:

Thrift: Missing Guide
Thrift Usage Objective-C

Advertisements

One thought on “About Cocoa Support in Apache Thrift

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s