Git Product home page Git Product logo

protobuf-objc's Introduction

protobuf-objc's People

Contributors

chapados avatar dicej avatar evanj avatar jhhsia avatar jparise avatar macdrevx avatar michaelpetrov avatar wader avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

protobuf-objc's Issues

Repeated fields with primitive non Object types throw an exception when printing

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?

generated isEquals fails when a repeated object has no entries

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.

Tag a version

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!

  • nevyn

Configure issue

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.

Protobuf metadata support?

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).

iOS InvalidProtocolBuffer, truncatedMessage

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

Compiler warning on lines 542 and 549 of ConcreteExtensionField.m (in runtime project)

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.

make command fails with error

I followed the normal steps for installing...

  1. ./autogen.sh
  2. ./configure
  3. make

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

Services

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.

CodedOutputStream.h declares two methods twice which causes compile warnings.

The file contains:

/** Write a little-endian 32-bit integer. */

  • (void) writeRawLittleEndian32:(int32_t) value;
    /** Write a little-endian 64-bit integer. */
  • (void) writeRawLittleEndian64:(int64_t) value;

and then a bit further down:

  • (void) writeRawLittleEndian32:(int32_t) value;
  • (void) writeRawLittleEndian64:(int64_t) value;

This causes compiler warnings.

bf7da0 broke objectivec-descriptor

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/

Unable to find License Information

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.

easy way to modify a message object

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++.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.