Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I recently used protocol buffers to great effect in this particular area. It's got very very little overhead and performs better than the native objective C serialization/deserialization(at least on the ipod touch I'm testing for performance with, since it is the slowest device we want to support).</p> <p>It took me a while to set them up as a newbie in iOS development though(the python side was really easy though).</p> <p>This blog post really helps: <a href="http://nserror.me/blog/2011/06/03/protocol-buffers-and-xcode/" rel="nofollow">http://nserror.me/blog/2011/06/03/protocol-buffers-and-xcode/</a></p> <p>To summarize on how to integrate protocol buffers into an objective C project -- This took me a whole day to piece together so I'm putting it up in the hope someone in my situation finds it useful:</p> <ul> <li>get protocol buffers from <a href="http://code.google.com/p/protobuf/" rel="nofollow">here</a></li> <li>configure/make/make install</li> <li>get <a href="https://github.com/booyah/protobuf-objc" rel="nofollow">this</a> project(that's git clone <a href="https://github.com/booyah/protobuf-objc.git" rel="nofollow">https://github.com/booyah/protobuf-objc.git</a> for the lazy)</li> <li>autogen.sh/configure/make/make install</li> <li>In protobuf-objc/src/runtime there is an xcode project. Open it, build and then close xcode again. It is really important you do this.</li> <li>open up your project in Xcode. Go to the "build rules" tab in the target. Add a custom build rule for *.proto files.</li> </ul> <p>The script:</p> <pre><code>/usr/local/bin/protoc --plugin=/usr/local/bin/protoc-gen-objc \ --proto_path=${INPUT_FILE_DIR} \ --objc_out=${DERIVED_SOURCES_DIR} \ ${INPUT_FILE_PATH} </code></pre> <p>The output files:</p> <pre><code>${DERIVED_SOURCES_DIR}/${INPUT_FILE_BASE}.pb.h ${DERIVED_SOURCES_DIR}/${INPUT_FILE_BASE}.pb.m </code></pre> <ul> <li>copy the protobuf-objc project into the same directory you have your .xcodeproj in</li> <li>Add a reference to the project in protobuf-obj/src/runtime (just drag into from finder into your project</li> <li>Under "build phases" for your target add a dependency on ProtocolBuffers</li> <li>Under "build settings" select the "all" view and add the following to your header search paths: ${SOURCE_ROOT}/protobuf-objc/src/runtime/Build/Products</li> <li>In the summary for your target, add a link to the .a file generated by the ProtocolBuffers project.</li> <li>And that's it, from now on, you just add your .proto files to the project(and to the list of files to be compiled) and you can use protocol buffers</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload