using https://github.com/mingchen/protobuf-ios First is to download it down
it uses the command line .
$ cd compiler$ ./autogen.sh$ ./configure$ make$ make install (optional)
The compiler is genrated at
src/protoc . In the SRC directory, generate a command-line tool PROTOC that can generate. m files from the. proto file .
Of course, the installation process encountered several problemsyou need to install brew first, this installation process, the direct use of the official installation method can be installed, is a word,Brew can be used for easy installation of software
http://brew.sh Https://github.com/Homebrew/homebrew
installation, as long as a commandruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"
after installation, you need to install it again.Brew Install Automake
Brew Install autoconfAlso, you may be prompted for a lack of libtool using the command brew install Libtool installation
when the final make command is executed, you will still encounter an error [Message.lo] 1 and need to change the file message.cc
+ #include <istream> (add this line)
How to useput a. proto file (called Person.proto), such as the followingmessage 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;
}
in the SCR directory, and then create a folder in the SRC peer BUILD/OBJCInvoke CommandSrc/protoc--proto_path=src--OBJC_OUT=BUILD/OBJC Src/person.proto will generateperson.pb.h and person.pb.m file two files, and these two files contain the corresponding OC object,
https://code.google.com/p/protobufeditor/this is. Proto's editing tools
Reference Document 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
Using Protocolbuf in Mac/ios