Use protocolBuf and iosprotocolbuf in MAC/IOS
Using the https://github.com/mingchen/protobuf-ios is first downloaded
It uses the command line
$ cd compiler$ ./autogen.sh$ ./configure$ make$ make install (optional)
The compiler is genrated
src/protoc. Generate a command line tool protoc under the src directory that can generate the. proto file. m file.
Of course, you have encountered several problems during the installation process. You need to install brew first. During the installation process, you can directly use the official installation method to install brew, brew can be used to install software conveniently.
Http://brew.sh https://github.com/Homebrew/homebrew
Install, just one command ruby-e "$ (curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
After installation, you need to install brew install automake again.
Brew install autoconf and may also prompt the lack of libtool to use the command brew install libtool to install
After the installation is complete, the Error [message. lo] Error 1 will still occur when the last make command is executed. You need to change the file message. cc.
#include <google/protobuf/stubs/stl_util-inl.h>
+ # Include <istream> (add this line)
Use a. proto file (Name: Person. proto), for example, the following message Person {
Required string name = 1;
Required int32 id = 2;
Optional string email = 3;
Enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
Message PhoneNumber {
Required string number = 1;
Optional PhoneType type = 2 [default = HOME];
}
Repeated PhoneNumber phone = 4;
}
Put it in the scr directory, and create the build/objc folder at the src same level to call the command src/protoc -- proto_path = src -- objc_out = build/objc src/Person. proto will generate Person. pb. h and Person. pb. the m file contains the corresponding oc object,
Https://code.google.com/p/protobufeditor/, this is an editing tool for. proto.
Reference http://www.cnblogs.com/uniy/archive/2011/12/21/2296405.html
Http://blog.csdn.net/hherima/article/details/17172441http://blog.csdn.net/hherima/article/details/21534673https://gist.github.com/BennettSmith/7150245