一. 安装终端protobuf编译生成.h .m工具
1.下载3.5.1版本objective-c
https://github.com/google/protobuf/releases

2. 解压进入执行下面命令
cd protobuf-3.0.0
./configure
make -j8
sudo make install
二. 编写 .proto 文件, 生成 .protoc.h .protoc.m文件
cd /Users/XXX/Desktop
1. 在桌面创建一个文件夹dir_pro
2.在dir_pro文件夹中创建一个 XXX.proto 文件
3. cd /Users/XXX/Desktop
使用protoc 命令生成objc文件
protoc --proto_path=dir_pro --objc_out=dir_pro dir_pro/XXX.proto
网友评论