iOS:使用protobuf

2021-01-07  本文已影响0人  春暖花已开
Protocol Buffers规范

支持的基本类型

double(double)
float(float)
int32(NSInteger)
int64(long long)
bool(BOOL)
string(NSString)
bytes(NSData)
map(Dictionary)
repeated(Array)
enum(NSInteger)

扩展类型

时间戳(long long)(秒)
金额(long long)[分]

约定

使用proto3规范,不要用嵌套类型
协议URL规范为../{response}.proto,response为message
'Y','ture' -> bool
可以转换为枚举的字符串和数字集合
可以转化为整数的字符串
时间建议用int64类型

使用

参考

protobuf 集成小结OC

上一篇 下一篇

猜你喜欢

热点阅读