booyah / protobuf-objc Goto Github PK
View Code? Open in Web Editor NEWProtocol Buffers for Objective C
Protocol Buffers for Objective C
This is the same issue as described in #4. The fix is the same as well.
Caught InvalidProtocolBuffer, truncatedMessage, (
0 CoreFoundation 0x33fd98d7 __exceptionPreprocess + 186
1 libobjc.A.dylib 0x342291e5 objc_exception_throw + 32
2 CooTekIM.dylib 0x0075c0b7 -[PBCodedInputStream refillBuffer:] + 806
3 CooTekIM.dylib 0x0075c653 -[PBCodedInputStream readRawData:] + 946
4 CooTekIM.dylib 0x0075ad91 -[PBCodedInputStream readString] + 444
5 CooTekIM.dylib 0x0076724f -[SearchResult_Result_Builder mergeFromCodedInputStream:extensionRegistry:] + 554
6 CooTekIM.dylib 0x0075b1e5 -[PBCodedInputStream readMessage:extensionRegistry:] + 360
7 CooTekIM.dylib 0x00768035 -[SearchResult_Builder mergeFromCodedInputStream:extensionRegistry:] + 600
8 CooTekIM.dylib 0x00767dd9 -[SearchResult_Builder mergeFromCodedInputStream:] + 104
9 CooTekIM.dylib 0x00759da7 -[PBAbstractMessage_Builder mergeFromData:] + 118
10 CooTekIM.dylib 0x007658a7 +[SearchResult parseFromData:] + 98
This issue is present in commit 60ac436
Trailing whitespace should be eliminated for ease of use with repositories that reject commits with trailing whitespace.
I met this problem , and how to solve it, when I mad a pod Framework , integrated Protobuf by "pod 'Protobuf' " by editting 'podspec file'and run the command 'pod lib lint xxx.podspec'. Counld anyone give me an idea to get it over? waiting for helpping from God. [smile]
The file contains:
/** Write a little-endian 32-bit integer. */
and then a bit further down:
This causes compiler warnings.
Do you have any plans on supporting metadata in the Obj-C generated code? The C++/Java implementations from google contain functionality for inspecting messages (for example accessing field names).
Trying to build the compiler as described in http://code.google.com/p/metasyntactic/wiki/ProtocolBuffers
When I run make I receive the following:
make[2]: Nothing to be done for `all-am'.
I can't find an API to modify a PB object like setting a field of an object.
It seems that to modify an object of PBGeneratedMessage
First I have to get the object builder,
and then set the field value through builder
and then call the build function of builder.
How can I directly modify the field value of an object. Just like what We can do in c++.
In commit 60ac436
Compiling with Apple LLVM compiler 3.0 yields the following warnings:
protobuf-objc/src/runtime/Classes/ConcreteExtensionField.m:542:29:{542:39-542:68}: warning: initializing 'id<PBMessage_Builder>' with an expression of incompatible type 'PBUnknownFieldSet_Builder *' [3]
id<PBMessage_Builder> builder = [messageOrGroupClass builder];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
protobuf-objc/src/runtime/Classes/ConcreteExtensionField.m:549:29:{549:39-549:68}: warning: initializing 'id<PBMessage_Builder>' with an expression of incompatible type 'PBUnknownFieldSet_Builder *' [3]
id<PBMessage_Builder> builder = [messageOrGroupClass builder];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I can provide additional configuration details upon request.
We have an object which includes a repeated field called errors.
Here is the return from the generated isEquals method:
return
self.hasType == otherMessage.hasType &&
(!self.hasType || self.type == otherMessage.type) &&
self.hasStatus == otherMessage.hasStatus &&
(!self.hasStatus || self.status == otherMessage.status) &&
self.hasMessage == otherMessage.hasMessage &&
(!self.hasMessage || [self.message isEqual:otherMessage.message]) &&
[self.errorsArray isEqualToArray:otherMessage.errorsArray] &&
[self isEqualExtensionsInOther:otherMessage from:100 to:536870912] &&
(self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
In my case errorsArray is nil. I am assuming this is because there were no errors (since zero is a valid number of times for a repeated field). This makes [self.errorsArray isEqualToArray:otherMessage.errorsArray]
returns false. The end result is objects with repeated fields that have zero entries can never test equal.
I can imagine a couple of fixes, e.g. having an empty array instead of nil or changing the test to make both sides being nil a valid situation, however I am not familiar enough with the code to know exactly where to place this. I glanced at the code that generates isEqualToArray but I'm not sure if the adding the nil test is always valid.
I have a message that defines a repeated int64. In the generated MessagePb objective-C class,
the - (void) writeDescriptionTo:(NSMutableString_) output withIndent:(NSString_) indent
method fails since the auto-generated code attempts to do fast enumeration over the items like so
for (NSNumber* value in self.itemsArray) {
[output appendFormat:@"%@%@: %@\n", indent, @"items", value];
}
in this case 'value' is actually of type PBArrayValueTypeInt64, which causes the exception to be thrown in line 186 of PBArray.m
Suggestions on how to fix this to return a new array of NSNumbers around primitive types?
Hi, I was wondering if you're planning on supporting Services such as this one
service UserRequest {
rpc userSearch(Name) returns(User);
}
When I run my proto file (with the messsages Name & User of course) I cannot find any RPC generated.
Could anyone please let me know the license information for using booyah/protobuf-objc project? I am not able to find it anywhere. Please help.
New users are given no guidance on how to install or use this project. The README should be updated to give simple instructions.
The while should be if. This fills up the whole buffer with the byte.
Hey,
In MumbleKit (1), I use the Objective-C descriptor to set a prefix that my protobuf-generated classes should have prepended to them.
Unfortunately, the commit bf7da01 broke my ability to use the Objective-C descriptor. Since names are no longer converted to CamelCase, the objc protobuf plugin generates an Objective-C class named 'objectivec-descriptor' for the Objective-C descriptor. Since dashes aren't valid in identifiers for class names, this doesn't quite work. :-)
I'm not sure if there's a workaround to make it easier than what I'm using in (1) to generate classes with a prefix. That would solve this particular problem for me, but it wouldn't really solve the issue of the compiler plugin not liking proto files with dashes in them.
(1): https://github.com/mkrautz/mumblekit/tree/master/proto/
On line 365 of objc_message_field.cc and on line 343 of objc_enum_field.cc, the copied object is assigned to a retain property. The copied objects, should therefore be autoreleased.
This issue was flagged in generated code in another project by the Xcode 4.1 static analyzer.
I'm following the usual installation instructions, but it's failing in the configure step. After downloading the ZIP & unpacking it:
./autogen.sh
./configure
And it fails with:
`...
checking google/protobuf/stubs/common.h usability... no
checking google/protobuf/stubs/common.h presence... no
checking for google/protobuf/stubs/common.h... no
configure: error:
ERROR: protobuf headers are required.
You must either install protobuf from google,
or if you have it installed in a custom location
you must add '-Iincludedir' to CXXFLAGS
and '-Llibdir' to LDFLAGS.
If you did not specify a prefix when installing
protobuf, try
'./configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib'
In some 64-bit environments, try LDFLAGS=-L/usr/local/lib64.`
Sure enough, there are only three files in google/protobuf/stubs/
and common.h
isn't there.
Would definitely be great since generated code cannot be re factored by ARC interpreter in order to migrate.
Hi! I'd like to bundle protobuf-objc as a CocoaPod (see cocoapods.org). However, it can't really be packaged properly without a version number. Would you mind tagging protobuf-objc with something? I've suggested 0.1.0 in my podspec I tried setting up (nevyn/Specs@bb0760d).
Thanks!
I followed the normal steps for installing...
I have no errors or warnings until I run make. The output from make is at the bottom of this.
I successfully installed Google protocol buffers version 2.5.0 right before this, so it should be the most up to date version. Is there anything I'm doing incorrectly? How can I get this to build?
Thanks,
Matt
abcs-MacBook-Pro:protobuf-objc qsr$ make
make all-recursive
Making all in src/compiler
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cc
mv -f .deps/main.Tpo .deps/main.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT objc_enum_field.o -MD -MP -MF .deps/objc_enum_field.Tpo -c -o objc_enum_field.o objc_enum_field.cc
mv -f .deps/objc_enum_field.Tpo .deps/objc_enum_field.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT objc_file.o -MD -MP -MF .deps/objc_file.Tpo -c -o objc_file.o objc_file.cc
mv -f .deps/objc_file.Tpo .deps/objc_file.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT objc_message_field.o -MD -MP -MF .deps/objc_message_field.Tpo -c -o objc_message_field.o objc_message_field.cc
mv -f .deps/objc_message_field.Tpo .deps/objc_message_field.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT objc_enum.o -MD -MP -MF .deps/objc_enum.Tpo -c -o objc_enum.o objc_enum.cc
mv -f .deps/objc_enum.Tpo .deps/objc_enum.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT objc_generator.o -MD -MP -MF .deps/objc_generator.Tpo -c -o objc_generator.o objc_generator.cc
mv -f .deps/objc_generator.Tpo .deps/objc_generator.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT objc_primitive_field.o -MD -MP -MF .deps/objc_primitive_field.Tpo -c -o objc_primitive_field.o objc_primitive_field.cc
mv -f .deps/objc_primitive_field.Tpo .deps/objc_primitive_field.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT objc_extension.o -MD -MP -MF .deps/objc_extension.Tpo -c -o objc_extension.o objc_extension.cc
mv -f .deps/objc_extension.Tpo .deps/objc_extension.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -g -O2 -DNDEBUG -MT objc_helpers.o -MD -MP -MF .deps/objc_helpers.Tpo -c -o objc_helpers.o objc_helpers.cc
In file included from objc_helpers.cc:27:
google/protobuf/objectivec-descriptor.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
google/protobuf/objectivec-descriptor.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
google/protobuf/objectivec-descriptor.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
make[2]: *** [objc_helpers.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.