Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mingchen/protobuf-ios
[Deprecated] An Objective-C implementation of Google proto buffer for iOS
https://github.com/mingchen/protobuf-ios
Last synced: 18 days ago
JSON representation
[Deprecated] An Objective-C implementation of Google proto buffer for iOS
- Host: GitHub
- URL: https://github.com/mingchen/protobuf-ios
- Owner: mingchen
- License: mit
- Archived: true
- Created: 2012-08-21T02:17:53.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2019-01-18T19:07:31.000Z (almost 6 years ago)
- Last Synced: 2024-04-24T13:17:23.453Z (7 months ago)
- Language: C++
- Homepage:
- Size: 1.94 MB
- Stars: 161
- Watchers: 15
- Forks: 41
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# protobuf-ios
## Introduction
[![travis-ci build status](https://travis-ci.org/mingchen/protobuf-ios.svg?branch=master)](https://travis-ci.org/mingchen/protobuf-ios)
An **Objective-C** implementation of Google **proto buffer** for **iOS**.
The orignal code comes from [Booyah Inc](https://github.com/booyah/protobuf-objc). This implemenation add features to support write to / parse from delimited stream. This git repo also support [cocoapods](http://cocoapods.org).## Supported Platform
* iOS 4.0 and above
* Xcode 4 and above## Features
- Support write to / parse from delimited stream (protobuf 2.3 feature).
## Examples
### Simple Usage
You write a `foo.proto` file like this:
message Person {
required int32 id = 1;
required string name = 2;
optional string email = 3;
}
Then you compile it with `protoc` to produce code in Objective-C (see below).Serialize to protobuf format:
Person* person = [[[[[Person builder] setId:123]
setName:@"Bob"]
setEmail:@"[email protected]"] build];
NSData* data = [person data];
Unserialize from protobuf format data:NSData* raw_data = ...;
Person* person = [Person parseFromData:raw_data];### Delimited encode
Sometime is very useful to write multiple protobuf objects into a single file.
This need use delimited format. Here is an example:
// serialize
NSOutputStream *ouputStream = [NSOutputStream outputStreamToFileAtPath:@"filename.dat" append:YES];
[ouputStream open];
for (int i=0; i