[]嵌套类型的protobuf报错
message LoginResult {
required int32 result = 1;
optional string authToken = 2;
repeated ServerInfo serverList = 3;
optional int32 platformErrorCode = 4;
optional string par1 = 5;
optional string par2 = 6;
optional string recommendedUId = 7;
}
message ServerInfo {
required int32 id = 1;
required string name = 2;
required string address = 3;
required int32 status = 4;
optional string serverUId = 5;
optional int32 controlStatus = 6;
optional string closeMessage = 7;
}
这种嵌套类型的proto decode的时候报错
Uncaught TypeError: this.clazz is not a constructor
at Message.ProtoBuf.Reflect.MessagePrototype.decode (protobuf.js?tick=17185:3213)
at Element.ProtoBuf.Reflect.ElementPrototype.decode (protobuf.js?tick=17185:2201)
at Field.ProtoBuf.Reflect.FieldPrototype.decode (protobuf.js?tick=17185:3743)
at Message.ProtoBuf.Reflect.MessagePrototype.decode (protobuf.js?tick=17185:3249)
at Function.ProtoBuf.Reflect.MessagePrototype.build.Message.decode (protobuf.js?tick=17185:2949)
at ProtobufConverter.gtea.net.ProtobufConverter.__proto__.decode (gtea.js?tick=17185:1120)
at XMLHttpRequest.BaseUI.extend.getServerData.request.onreadystatechange (login.js:467)
required int32 result = 1;
optional string authToken = 2;
repeated ServerInfo serverList = 3;
optional int32 platformErrorCode = 4;
optional string par1 = 5;
optional string par2 = 6;
optional string recommendedUId = 7;
}
message ServerInfo {
required int32 id = 1;
required string name = 2;
required string address = 3;
required int32 status = 4;
optional string serverUId = 5;
optional int32 controlStatus = 6;
optional string closeMessage = 7;
}
这种嵌套类型的proto decode的时候报错
Uncaught TypeError: this.clazz is not a constructor
at Message.ProtoBuf.Reflect.MessagePrototype.decode (protobuf.js?tick=17185:3213)
at Element.ProtoBuf.Reflect.ElementPrototype.decode (protobuf.js?tick=17185:2201)
at Field.ProtoBuf.Reflect.FieldPrototype.decode (protobuf.js?tick=17185:3743)
at Message.ProtoBuf.Reflect.MessagePrototype.decode (protobuf.js?tick=17185:3249)
at Function.ProtoBuf.Reflect.MessagePrototype.build.Message.decode (protobuf.js?tick=17185:2949)
at ProtobufConverter.gtea.net.ProtobufConverter.__proto__.decode (gtea.js?tick=17185:1120)
at XMLHttpRequest.BaseUI.extend.getServerData.request.onreadystatechange (login.js:467)
我也碰到一个protobuf的问题,a.proto中 import b.proto, loadProto(a.proto) 报错,不知道你那里碰到了么
http://ask.layabox.com/question/2249
http://ask.layabox.com/question/2249
这个属于protobuf的第三方工具的功能使用,不在layaAir技术支持范围之内,建议开发者可以找下protobuf的学习资料,先自己了解下。因为我们是支持第三方工具功能的使用,对原生工具的功能不会做任何修改。
要回复问题请先登录