Giter VIP home page Giter VIP logo

protobuf-objc's Introduction

Protocol Buffers for Objective-C

Build Status Version Platform

An implementation of Protocol Buffers in Objective C.

Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. This project is based on an implementation of Protocol Buffers from Google. See the Google protobuf project for more information.

This fork contains only ARC version of library.

How To Install Protobuf

Building the Objective-C Protobuf compiler

  1. Check if you have Homebrew brew -v
  2. If you don't already have Homebrew, then install it ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  3. Install the main Protobuf compiler and required tools brew install automake brew install libtool brew install protobuf
  4. (optional) Create a symlink to your Protobuf compiler. ln -s /usr/local/Cellar/protobuf/2.6.1/bin/protoc /usr/local/bin
  5. Clone this repository. git clone https://github.com/alexeyxo/protobuf-objc.git
  6. Build it! ./scripts/build.sh

Adding to your project as a sub project

...

  1. Add /src/runtime/ProtocolBuffers.xcodeproj in your project.

Adding to your project as a CocoaPod

...

  1. cd <your .xcodeproj directory>

  2. echo -e "platform :ios , 6.0 \nlink_with '<YourAppTarget>', '<YourAppTarget_Test>' \npod 'ProtocolBuffers'" > Podfile

  3. pod install

Compile ".proto" files.

protoc --plugin=/usr/local/bin/protoc-gen-objc person.proto --objc_out="./"

Compilation Options

The protobuf-objc compiler recognizes several obj-c specific compilation options. These are added to the beginning of your .proto file:

    package dataexchange;

    import "objectivec-descriptor.proto";
    option (google.protobuf.objectivec_file_options).package = "DataExchange";
    option (google.protobuf.objectivec_file_options).class_prefix = "DE";
    option (google.protobuf.objectivec_file_options).relax_camel_case = true;
    .
    .
    .

Options

package

Sets the Objective-C package where classes generated from this .proto will be placed. This is typically used since Objective-C libraries output all their headers into a single directory. i.e. Foundation/* AddressBook/* UIKit/* etc. etc.

class_prefix

The string to be prefixed in front of all classes in order to make them 'cocoa-y'. i.e. 'NS/AB/CF/PB' for the NextStep/AddressBook/CoreFoundation/ProtocolBuffer libraries respectively. This will commonly be the capitalized letters from the above defined package directory.

relax_camel_case

Values: true/false.

Relaxes the strict camel case that is the default.

When this option is set, only the first letter after an underscore is forced to uppercase. I added this feature so that the generated obj-c code could more closely match our own in-house camel casing style.

Example:

    enum Gender {
      GUnknown  = 0;
      GFemale   = 1;
      GMale     = 2;
      GOther    = 3;
    }

    enum PlatformType {
      PTUnknown   = 0;
      PTiOS       = 1;
      PTAndroid   = 2;
      PTWeb       = 3;
    }

Normal output:

    typedef NS_ENUM(SInt32, HMGender) {
      HMGenderGunknown = 0,
      HMGenderGfemale = 1,
      HMGenderGmale = 2,
      HMGenderGother = 3,
    };

    typedef NS_ENUM(SInt32, HMPlatformType) {
      HMPlatformTypePtunknown = 0,
      HMPlatformTypePtiOs = 1,
      HMPlatformTypePtandroid = 2,
      HMPlatformTypePtweb = 3,
    };

Relaxed camel case:

    typedef NS_ENUM(SInt32, HMGender) {
      HMGenderGUnknown = 0,
      HMGenderGFemale = 1,
      HMGenderGMale = 2,
      HMGenderGOther = 3,
    };

    typedef NS_ENUM(SInt32, HMPlatformType) {
      HMPlatformTypePTUnknown = 0,
      HMPlatformTypePTiOS = 1,
      HMPlatformTypePTAndroid = 2,
      HMPlatformTypePTWeb = 3,
    };

Protobuf Examples

Web

Server-side requires Ruby(2.0+) and Sinatra gem.

To start ruby sinatra.rb in /Example/Web

if you need to recompile ruby proto models please install ruby_protobuf gem and make 'rprotoc person.proto'

iOS Example

/Example/iOS/Proto.xcodeproj

Project contains protobuf example and small json comparison.

Credits

Maintainer - Alexey Khokhlov

Booyah Inc. - Jon Parise

Google Protocol Buffers, Objective C - Cyrus Najmabadi - Sergey Martynov

Google Protocol Buffers - Kenton Varda, Sanjay Ghemawat, Jeff Dean, and others

protobuf-objc's People

Contributors

alexeyxo avatar chapados avatar coffellas-cto avatar daj avatar dicej avatar e-b-smith avatar evanj avatar gregschlom avatar jeanjoskin avatar jhhsia avatar jparise avatar jroersma avatar macdrevx avatar michaelpetrov avatar rachelblackman avatar serheo avatar stigger avatar tobefuturer 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

protobuf-objc's Issues

Duplicate symbols when including runtime via cocoapods

When I add

pod 'ProtocolBuffers', '1.2'

to an existing Podfile, all of the ProtocolBuffers runtime's .m files end up being included multiple times in Pods.xcodeproj's Build Phases->Compile Sources section. Deleting the duplicate .m files from this list fixes the issue.

An possible explanation is this Podfile uses the "link_with" directive with a list of two targets (one the main app target, and one is the test target).

E.g. we have something like:

link_with 'App', 'AppTests' 

fatal error: 'google/protobuf/compiler/plugin.h' file not found

$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in src/compiler
g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/include -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cc
main.cc:17:10: fatal error: 'google/protobuf/compiler/plugin.h' file not found

include <google/protobuf/compiler/plugin.h>

     ^

1 error generated.
make[2]: *** [main.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
$ make install
Making install in src/compiler
g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/include -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cc
main.cc:17:10: fatal error: 'google/protobuf/compiler/plugin.h' file not found

include <google/protobuf/compiler/plugin.h>

     ^

1 error generated.
make[1]: *** [main.o] Error 1
make: *** [install-recursive] Error 1

build.sh error on OSX 10.10

build.sh can not find protobuf headers. Where they are?

make: *** No rule to make target `clean'.  Stop.
glibtoolize: putting auxiliary files in `.'.
glibtoolize: copying file `./ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
glibtoolize: copying file `m4/libtool.m4'
glibtoolize: copying file `m4/ltoptions.m4'
glibtoolize: copying file `m4/ltsugar.m4'
glibtoolize: copying file `m4/ltversion.m4'
glibtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:9: installing './config.guess'
configure.ac:9: installing './config.sub'
configure.ac:10: installing './install-sh'
configure.ac:10: installing './missing'
src/compiler/Makefile.am:5: warning: source file 'google/protobuf/objectivec-descriptor.pb.cc' is in a subdirectory,
src/compiler/Makefile.am:5: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
src/compiler/Makefile.am: installing './depcomp'
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking target system type... x86_64-apple-darwin14.0.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking C++ compiler flags...... use default: -g -O2 -DNDEBUG
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /opt/local/bin/nm
checking the name lister (/opt/local/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin14.0.0 file names to x86_64-apple-darwin14.0.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin14.0.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /opt/local/bin/nm output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin14.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin14.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for inttypes.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for working memcmp... yes
checking for working strtod... yes
checking for ftruncate... yes
checking for memset... yes
checking for mkdir... yes
checking for strchr... yes
checking for strerror... yes
checking for strtol... yes
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.

make: *** No targets specified and no makefile found.  Stop.

Namespaces are not respected

Hello! Thanks for maintaining this project. We're evaluating using this for our iOS apps and have run into a filename-collision issue, which seems to be caused by protobuf-objc not respecting package namespaces. Repro:

foo/person.proto:

package foo;

message Person {
 optional uint32 age = 1;
}

bar/person.proto:

package bar;

message Person {
 optional uint32 age = 1;
}

output:

~ protoc --plugin=../../protobuf-objc/src/compiler/protoc-gen-objc {foo,bar}/person.proto --objc_out=../../objc_protos
Person.pb.h: Tried to write the same file twice.
Person.pb.m: Tried to write the same file twice.
~ echo $?
1

Problem with generated include

These are top lines of generated file:

// Generated by the protocol buffer compiler.  DO NOT EDIT!

#import "ProtocolBuffers.h"

#import "ObjectivecDescriptor.pb.h"

But I cant find ObjectivecDescriptor.pb.h anywhere!

Rocket Emoji is causing issues.

I'm having issues with protocol buffers that contain rocket emoji.

I'm going to investigate this further by the end of the week but I already wanted to report the bug in case someone else wanted to take a look at it earlier.

hi,here is a problem about parse

i'm make a pb object send to server, but server can't parse

here is my client code :
IMLoginReqBuilder *login = [IMLoginReq builder];
[login setUserName:@"test"];
[login setPassword:@"123456"];
[login setClientType:ClientTypeClientTypeIos];
[login setClientVersion:clientVersion];
[login setOnlineStatus:UserStatTypeUserStatusOnline];
IMLoginReq *test = [login build];
[dataout writeBytes:test.data];

and C++ server print :
Can't parse message of type "IM.Login.IMLoginReq" because it is missing required fields: (cannot determine missing fields for lite message)

file not found

Hello when i test the proto.xcodeproj i have this error:
'ProtocolBuffers/ProtocolBuffers.h' file not found
where it may come

This file was generated by a newer version of protoc

Hi, I followed the tutorial step by step.

  1. Check if you have Homebrew brew -v
  2. If you don't already have Homebrew, then install it ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  3. Install the main Protobuf compiler and required tools brew install automake brew install libtool brew install protobuf
  4. (optional) Create a symlink to your Protobuf compiler. ln -s /usr/local/Cellar/protobuf/2.6.1/bin/protoc /usr/local/bin
  5. Clone this repository. git clone https://github.com/alexeyxo/protobuf-objc.git
  6. Build it! ./scripts/build.sh

But when I wanted to build it with the final one "./scripts/build.sh",
I got the following error messages...

///_Error Messages_*********///
In file included from objc_extension.cc:19:
./google/protobuf/descriptor.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^
./google/protobuf/descriptor.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^
./google/protobuf/descriptor.pb.h:14:2: error: your headers.

error your headers.

^
mv -f .deps/main.Tpo .deps/main.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/include -MT objc_helpers.o -MD -MP -MF .deps/objc_helpers.Tpo -c -o objc_helpers.o objc_helpers.cc
In file included from objc_generator.cc:22:
./google/protobuf/descriptor.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^
./google/protobuf/descriptor.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^
./google/protobuf/descriptor.pb.h:14:2: error: your headers.

error your headers.

^
In file included from objc_primitive_field.cc:25:
In file included from /usr/local/include/google/protobuf/wire_format.h:43:
./google/protobuf/descriptor.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^
./google/protobuf/descriptor.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^
./google/protobuf/descriptor.pb.h:14:2: error: your headers.

error your headers.

^
In file included from objc_enum.cc:24:
./google/protobuf/descriptor.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^
./google/protobuf/descriptor.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^
./google/protobuf/descriptor.pb.h:14:2: error: your headers.

error your headers.

^
In file included from objc_file.cc:23:
./google/protobuf/descriptor.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^
./google/protobuf/descriptor.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^
./google/protobuf/descriptor.pb.h:14:2: error: your headers.

error your headers.

^
In file included from objc_enum_field.cc:25:
In file included from /usr/local/include/google/protobuf/wire_format.h:43:
./google/protobuf/descriptor.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^
./google/protobuf/descriptor.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^
./google/protobuf/descriptor.pb.h:14:2: error: your headers.

error your headers.

^
In file included from objc_message_field.cc:24:
In file included from /usr/local/include/google/protobuf/wire_format.h:43:
./google/protobuf/descriptor.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^
./google/protobuf/descriptor.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^
./google/protobuf/descriptor.pb.h:14:2: error: your headers.

error your headers.

^
./google/protobuf/descriptor.pb.h:26:10: fatal error: 'google/protobuf/generated_enum_reflection.h' file not found

include <google/protobuf/generated_enum_reflection.h>

     ^

./google/protobuf/descriptor.pb.h:26:10: fatal error: 'google/protobuf/generated_enum_reflection.h' file not found

include <google/protobuf/generated_enum_reflection.h>

     ^

./google/protobuf/descriptor.pb.h:26:10: fatal error: 'google/protobuf/generated_enum_reflection.h' file not found

include <google/protobuf/generated_enum_reflection.h>

     ^

./google/protobuf/descriptor.pb.h:26:10: fatal error: 'google/protobuf/generated_enum_reflection.h' file not found

include <google/protobuf/generated_enum_reflection.h>

     ^

./google/protobuf/descriptor.pb.h:26:10: fatal error: 'google/protobuf/generated_enum_reflection.h' file not found

include <google/protobuf/generated_enum_reflection.h>

     ^

./google/protobuf/descriptor.pb.h:26:10: fatal error: 'google/protobuf/generated_enum_reflection.h' file not found

include <google/protobuf/generated_enum_reflection.h>

     ^

./google/protobuf/descriptor.pb.h:26:10: fatal error: 'google/protobuf/generated_enum_reflection.h' file not found

include <google/protobuf/generated_enum_reflection.h>

     ^

4 errors generated.
4 errors generated.
4 errors generated.
make[2]: *** [objc_generator.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [objc_extension.o] Error 1
4 errors generated.
make[2]: *** [objc_enum.o] Error 1
4 errors generated.
make[2]: *** [objc_primitive_field.o] Error 1
4 errors generated.
make[2]: *** [objc_message_field.o] Error 1
make[2]: *** [objc_enum_field.o] Error 1
In file included from objc_helpers.cc:18:
In file included from ./objc_helpers.h:23:
./google/protobuf/descriptor.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^
./google/protobuf/descriptor.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^
./google/protobuf/descriptor.pb.h:14:2: error: your headers.

error your headers.

^
./google/protobuf/descriptor.pb.h:26:10: fatal error: 'google/protobuf/generated_enum_reflection.h' file not found

include <google/protobuf/generated_enum_reflection.h>

     ^

4 errors generated.
make[2]: * [objc_helpers.o] Error 1
4 errors generated.
make[2]: * [objc_file.o] Error 1
make[1]: * [all-recursive] Error 1
make: * [all] Error 2
///
_Error Messages_*****************///

I don't know how to do now. Can anyone help ?
Thanks a lot.

Undefined symbols

It seems no matter what I try, I cannot get around a link problem in my project:

Undefined symbols for architecture arm64:
"computeDoubleSize(int, double)", referenced from:
-[SCFrameScores serializedSize] in Asap.pb.o
"computeFloatSize(int, float)", referenced from:

It is the same for all architectures I try to build for : i386 or x86_64 or arm64
It seems that my project is not finding the protobuf library. I have tried:

  • adding ProtocolBuffers.xcodeproject as a sub projet - same problem
  • using Cocoapods to install ProtocolBuffers (1.9.8) - same problem
  • building ProtcolBuffers.xcodeproject's framework and adding manually to my project - same problem

I imagine it is some simple change, but I can't seem to find it.

Thanks for your help!

Compiling error: "PBGeneratedMessage_Builder" not found!

protobuf version: 2.6.1
protobuf-objc: 1.9.6

All *.pb.m files raise this error:

Cannot find interface declaration for 'PBGeneratedMessage_Builder', superclass of 'PBLoginResult_Builder'; did you mean 'PBGeneratedMessageBuilder'?

How to add to your own xcode project

First of all I have to say thank you, I am glad I found your updated project which is helping me a lot already. After having successfully compiled my proto files I am now trying to add the Library to my XCode Project. The example is quite helpful but I am still having issues on how to do that.
After I have added the ProtoculBuffers.xcodeproj to my project what to I have to do to make my code aware of its existence?

Also it would be great to have that description in the readme.
Thank you.

Unable to generate Objc

protoc --plugin=/usr/local/bin/protoc-gen-objc person.proto --objc_out="./"

returns

/usr/local/bin/protoc-gen-objc: program not found or is not executable
--objc_out: protoc-gen-objc: Plugin failed with status code 1.

Generated bag on @property

Hello, I found a bug in the generation of files. I have a field "repeated records". He generate in obj-c "property (readonly, strong) PBArray * records;", but mettod getting redefined and nourish "NSMutableArray * recordsArray"

My proto model

message TimeSheetModel {
    required string  id = 1;
    required string startDate = 2;
    required string endDate = 3;
    optional string account = 4;
    optional string approver = 5;
    optional string publisher = 6;
    required TimesheetPublishStatus publishStatus = 7;
    repeated string records = 8;
    required int64 totalDuration = 9;
}

@interface TimeSheetModel : PBGeneratedMessage {
@private
  BOOL hasTotalDuration_:1;
  BOOL hasId_:1;
  BOOL hasStartDate_:1;
  BOOL hasEndDate_:1;
  BOOL hasAccount_:1;
  BOOL hasApprover_:1;
  BOOL hasPublisher_:1;
  BOOL hasPublishStatus_:1;
  SInt64 totalDuration;
  NSString* id;
  NSString* startDate;
  NSString* endDate;
  NSString* account;
  NSString* approver;
  NSString* publisher;
  TimesheetPublishStatus publishStatus;
  NSMutableArray * recordsArray;
}
- (BOOL) hasId;
- (BOOL) hasStartDate;
- (BOOL) hasEndDate;
- (BOOL) hasAccount;
- (BOOL) hasApprover;
- (BOOL) hasPublisher;
- (BOOL) hasPublishStatus;
- (BOOL) hasTotalDuration;
@property (readonly, strong) NSString* id;
@property (readonly, strong) NSString* startDate;
@property (readonly, strong) NSString* endDate;
@property (readonly, strong) NSString* account;
@property (readonly, strong) NSString* approver;
@property (readonly, strong) NSString* publisher;
@property (readonly) TimesheetPublishStatus publishStatus;
@property (readonly, strong) PBArray * records;
@property (readonly) SInt64 totalDuration;
- (NSString*)recordsAtIndex:(NSUInteger)index;

+ (TimeSheetModel*) defaultInstance;
- (TimeSheetModel*) defaultInstance;

- (BOOL) isInitialized;
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output;
- (TimeSheetModelBuilder*) builder;
+ (TimeSheetModelBuilder*) builder;
+ (TimeSheetModelBuilder*) builderWithPrototype:(TimeSheetModel*) prototype;
- (TimeSheetModelBuilder*) toBuilder;

+ (TimeSheetModel*) parseFromData:(NSData*) data;
+ (TimeSheetModel*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (TimeSheetModel*) parseFromInputStream:(NSInputStream*) input;
+ (TimeSheetModel*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
+ (TimeSheetModel*) parseFromCodedInputStream:(PBCodedInputStream*) input;
+ (TimeSheetModel*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
@end
@interface TimeSheetModel ()
@property (strong) NSString* id;
@property (strong) NSString* startDate;
@property (strong) NSString* endDate;
@property (strong) NSString* account;
@property (strong) NSString* approver;
@property (strong) NSString* publisher;
@property TimesheetPublishStatus publishStatus;
@property (strong) NSMutableArray * recordsArray;
@property SInt64 totalDuration;
@end

@implementation TimeSheetModel

- (BOOL) hasId {
  return !!hasId_;
}
- (void) setHasId:(BOOL) value_ {
  hasId_ = !!value_;
}
@synthesize id;
- (BOOL) hasStartDate {
  return !!hasStartDate_;
}
- (void) setHasStartDate:(BOOL) value_ {
  hasStartDate_ = !!value_;
}
@synthesize startDate;
- (BOOL) hasEndDate {
  return !!hasEndDate_;
}
- (void) setHasEndDate:(BOOL) value_ {
  hasEndDate_ = !!value_;
}
@synthesize endDate;
- (BOOL) hasAccount {
  return !!hasAccount_;
}
- (void) setHasAccount:(BOOL) value_ {
  hasAccount_ = !!value_;
}
@synthesize account;
- (BOOL) hasApprover {
  return !!hasApprover_;
}
- (void) setHasApprover:(BOOL) value_ {
  hasApprover_ = !!value_;
}
@synthesize approver;
- (BOOL) hasPublisher {
  return !!hasPublisher_;
}
- (void) setHasPublisher:(BOOL) value_ {
  hasPublisher_ = !!value_;
}
@synthesize publisher;
- (BOOL) hasPublishStatus {
  return !!hasPublishStatus_;
}
- (void) setHasPublishStatus:(BOOL) value_ {
  hasPublishStatus_ = !!value_;
}
@synthesize publishStatus;
@synthesize recordsArray;
@dynamic records;
- (BOOL) hasTotalDuration {
  return !!hasTotalDuration_;
}
- (void) setHasTotalDuration:(BOOL) value_ {
  hasTotalDuration_ = !!value_;
}
@synthesize totalDuration;
- (id) init {
  if ((self = [super init])) {
    self.id = @"";
    self.startDate = @"";
    self.endDate = @"";
    self.account = @"";
    self.approver = @"";
    self.publisher = @"";
    self.publishStatus = TimesheetPublishStatusNotPublished;
    self.totalDuration = 0L;
  }
  return self;
}
static TimeSheetModel* defaultTimeSheetModelInstance = nil;
+ (void) initialize {
  if (self == [TimeSheetModel class]) {
    defaultTimeSheetModelInstance = [[TimeSheetModel alloc] init];
  }
}
+ (TimeSheetModel*) defaultInstance {
  return defaultTimeSheetModelInstance;
}
- (TimeSheetModel*) defaultInstance {
  return defaultTimeSheetModelInstance;
}
- (NSArray *)records {
  return recordsArray;
}
- (NSString*)recordsAtIndex:(NSUInteger)index {
  return [recordsArray objectAtIndex:index];
}
- (BOOL) isInitialized {
  if (!self.hasId) {
    return NO;
  }
  if (!self.hasStartDate) {
    return NO;
  }
  if (!self.hasEndDate) {
    return NO;
  }
  if (!self.hasPublishStatus) {
    return NO;
  }
  if (!self.hasTotalDuration) {
    return NO;
  }
  return YES;
}
- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output {
  if (self.hasId) {
    [output writeString:1 value:self.id];
  }
  if (self.hasStartDate) {
    [output writeString:2 value:self.startDate];
  }
  if (self.hasEndDate) {
    [output writeString:3 value:self.endDate];
  }
  if (self.hasAccount) {
    [output writeString:4 value:self.account];
  }
  if (self.hasApprover) {
    [output writeString:5 value:self.approver];
  }
  if (self.hasPublisher) {
    [output writeString:6 value:self.publisher];
  }
  if (self.hasPublishStatus) {
    [output writeEnum:7 value:self.publishStatus];
  }
  [self.recordsArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) {
    [output writeString:8 value:element];
  }];
  if (self.hasTotalDuration) {
    [output writeInt64:9 value:self.totalDuration];
  }
  [self.unknownFields writeToCodedOutputStream:output];
}
- (SInt32) serializedSize {
  __block SInt32 size_ = memoizedSerializedSize;
  if (size_ != -1) {
    return size_;
  }

  size_ = 0;
  if (self.hasId) {
    size_ += computeStringSize(1, self.id);
  }
  if (self.hasStartDate) {
    size_ += computeStringSize(2, self.startDate);
  }
  if (self.hasEndDate) {
    size_ += computeStringSize(3, self.endDate);
  }
  if (self.hasAccount) {
    size_ += computeStringSize(4, self.account);
  }
  if (self.hasApprover) {
    size_ += computeStringSize(5, self.approver);
  }
  if (self.hasPublisher) {
    size_ += computeStringSize(6, self.publisher);
  }
  if (self.hasPublishStatus) {
    size_ += computeEnumSize(7, self.publishStatus);
  }
  {
    __block SInt32 dataSize = 0;
    const NSUInteger count = self.recordsArray.count;
    [self.recordsArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) {
      dataSize += computeStringSizeNoTag(element);
    }];
    size_ += dataSize;
    size_ += (SInt32)(1 * count);
  }
  if (self.hasTotalDuration) {
    size_ += computeInt64Size(9, self.totalDuration);
  }
  size_ += self.unknownFields.serializedSize;
  memoizedSerializedSize = size_;
  return size_;
}
+ (TimeSheetModel*) parseFromData:(NSData*) data {
  return (TimeSheetModel*)[[[TimeSheetModel builder] mergeFromData:data] build];
}
+ (TimeSheetModel*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry {
  return (TimeSheetModel*)[[[TimeSheetModel builder] mergeFromData:data extensionRegistry:extensionRegistry] build];
}
+ (TimeSheetModel*) parseFromInputStream:(NSInputStream*) input {
  return (TimeSheetModel*)[[[TimeSheetModel builder] mergeFromInputStream:input] build];
}
+ (TimeSheetModel*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry {
  return (TimeSheetModel*)[[[TimeSheetModel builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (TimeSheetModel*) parseFromCodedInputStream:(PBCodedInputStream*) input {
  return (TimeSheetModel*)[[[TimeSheetModel builder] mergeFromCodedInputStream:input] build];
}
+ (TimeSheetModel*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry {
  return (TimeSheetModel*)[[[TimeSheetModel builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build];
}
+ (TimeSheetModelBuilder*) builder {
  return [[TimeSheetModelBuilder alloc] init];
}
+ (TimeSheetModelBuilder*) builderWithPrototype:(TimeSheetModel*) prototype {
  return [[TimeSheetModel builder] mergeFrom:prototype];
}
- (TimeSheetModelBuilder*) builder {
  return [TimeSheetModel builder];
}
- (TimeSheetModelBuilder*) toBuilder {
  return [TimeSheetModel builderWithPrototype:self];
}
- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent {
  if (self.hasId) {
    [output appendFormat:@"%@%@: %@\n", indent, @"id", self.id];
  }
  if (self.hasStartDate) {
    [output appendFormat:@"%@%@: %@\n", indent, @"startDate", self.startDate];
  }
  if (self.hasEndDate) {
    [output appendFormat:@"%@%@: %@\n", indent, @"endDate", self.endDate];
  }
  if (self.hasAccount) {
    [output appendFormat:@"%@%@: %@\n", indent, @"account", self.account];
  }
  if (self.hasApprover) {
    [output appendFormat:@"%@%@: %@\n", indent, @"approver", self.approver];
  }
  if (self.hasPublisher) {
    [output appendFormat:@"%@%@: %@\n", indent, @"publisher", self.publisher];
  }
  if (self.hasPublishStatus) {
    [output appendFormat:@"%@%@: %@\n", indent, @"publishStatus", [NSNumber numberWithInteger:self.publishStatus]];
  }
  [self.recordsArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
    [output appendFormat:@"%@%@: %@\n", indent, @"records", obj];
  }];
  if (self.hasTotalDuration) {
    [output appendFormat:@"%@%@: %@\n", indent, @"totalDuration", [NSNumber numberWithLongLong:self.totalDuration]];
  }
  [self.unknownFields writeDescriptionTo:output withIndent:indent];
}
- (BOOL) isEqual:(id)other {
  if (other == self) {
    return YES;
  }
  if (![other isKindOfClass:[TimeSheetModel class]]) {
    return NO;
  }
  TimeSheetModel *otherMessage = other;
  return
      self.hasId == otherMessage.hasId &&
      (!self.hasId || [self.id isEqual:otherMessage.id]) &&
      self.hasStartDate == otherMessage.hasStartDate &&
      (!self.hasStartDate || [self.startDate isEqual:otherMessage.startDate]) &&
      self.hasEndDate == otherMessage.hasEndDate &&
      (!self.hasEndDate || [self.endDate isEqual:otherMessage.endDate]) &&
      self.hasAccount == otherMessage.hasAccount &&
      (!self.hasAccount || [self.account isEqual:otherMessage.account]) &&
      self.hasApprover == otherMessage.hasApprover &&
      (!self.hasApprover || [self.approver isEqual:otherMessage.approver]) &&
      self.hasPublisher == otherMessage.hasPublisher &&
      (!self.hasPublisher || [self.publisher isEqual:otherMessage.publisher]) &&
      self.hasPublishStatus == otherMessage.hasPublishStatus &&
      (!self.hasPublishStatus || self.publishStatus == otherMessage.publishStatus) &&
      [self.recordsArray isEqualToArray:otherMessage.recordsArray] &&
      self.hasTotalDuration == otherMessage.hasTotalDuration &&
      (!self.hasTotalDuration || self.totalDuration == otherMessage.totalDuration) &&
      (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
}
- (NSUInteger) hash {
  __block NSUInteger hashCode = 7;
  if (self.hasId) {
    hashCode = hashCode * 31 + [self.id hash];
  }
  if (self.hasStartDate) {
    hashCode = hashCode * 31 + [self.startDate hash];
  }
  if (self.hasEndDate) {
    hashCode = hashCode * 31 + [self.endDate hash];
  }
  if (self.hasAccount) {
    hashCode = hashCode * 31 + [self.account hash];
  }
  if (self.hasApprover) {
    hashCode = hashCode * 31 + [self.approver hash];
  }
  if (self.hasPublisher) {
    hashCode = hashCode * 31 + [self.publisher hash];
  }
  if (self.hasPublishStatus) {
    hashCode = hashCode * 31 + self.publishStatus;
  }
  [self.recordsArray enumerateObjectsUsingBlock:^(id element, NSUInteger idx, BOOL *stop) {
    hashCode = hashCode * 31 + [element hash];
  }];
  if (self.hasTotalDuration) {
    hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.totalDuration] hash];
  }
  hashCode = hashCode * 31 + [self.unknownFields hash];
  return hashCode;
}
@end

Upgrade to Cocoapod 0.36.0.beta.1 requires Umbrella Header Usage

I will have to admit I'm on the bit of the leading (aka: bleeding) edge here.

I'm adding Alamofire and ProtocolBuffers-Swift to an existing AFNetworking and ProtocolBuffers-Objc project. I upgraded to Cocoapods 0.36.0.beta.1, and installed Alamofire as so: pod 'Alamofire', '~> 1.1.3'.

After performing a pod install it seems that 0.36.0.beta.1 changed its style to use Umbrella Headers instead. This means that in the Protocol Buffers generated files stop being able to find the import #import "ProtocolBuffers.h".

I was able to fix this by changing #import "ProtocolBuffers.h" to @import ProtocolBuffers; or #import <ProtocolBuffers/ProtocolBuffers.h>. It seems like @import points to the 'umbrella' header generated by Cocoapods. Not sure which one is the right one to use.

Conflict with GoogleSignIn

New version of GoogleSignIn has a new dependency GoogleInterchangeUtilities, which contains static library for Google Protocol Buffers. That make it impossible to use with protobuf-objc, causes "Undefined symbol for architect xxx" when compile.

I know this problem maybe isn't your side, but I'm just asking if you have any way to fix this.

Issue with Extension stuff

Hi,

I am encountering an issue with Extension stuff, the log error is :
"Terminating app due to uncaught exception 'IllegalArgument', reason: 'Trying to use an extension for another type'".

Proto file is :

message SDKEventProto {
    enum Type
    {
        DateOfBirthRevealedEventProto = 2;
        DateOfBirthCorrectedEventProto = 3;
    }

    required Type type = 1;
    required string sdkId = 2;
    required int64 offset = 3;
    required int64 timestamp = 4;

    extensions 100 to max;
}

message DateOfBirthRevealedEventProto {
    extend SDKEventProto {
        required DateOfBirthRevealedEventProto event = 102;
    }

    required int64 dateOfBirth = 1;
}

In my iOS code, I am running this code :

SDKEventProtoBuilder *sdkEventBuilder = [SDKEventProto builder];
[sdkEventBuilder clear];
sdkEventBuilder.sdkId = sdkEvent.sdkId.UUIDString;
sdkEventBuilder.offset = sdkEvent.offset;
sdkEventBuilder.timestamp = sdkEvent.timestamp.timestampForAlgos;
sdkEventBuilder.type = SDKEventProtoTypeDateOfBirthRevealedEventProto;
DateOfBirthRevealedEventProtoBuilder *builder = [DateOfBirthRevealedEventProto builder];
[builder clear];
OMSDateOfBirthRevealedEvent *event = (OMSDateOfBirthRevealedEvent *)sdkEvent;
builder.dateOfBirth = event.dateOfBirth.timestampForAlgos;
[sdkEventBuilder setExtension:[DateOfBirthRevealedEventProto event] value:builder.build];

Do you see anything bad in that ?

Clone project

When I compiled external proto files I got a lot of warnings and few compiler errors. I would like to fixed them, but can't clone the project, it says access denied.

Leak of dynamically-allocated memory in PBArray.m

Looks like a memory leak was introduced in the d6cb4e4 commit. In PBArray.m, in the implementation of PBAppendableArray, the -dealloc method was removed. That -dealloc method freed the _data memory (which was dynamically malloc()'d in the initializer and possibly reallocf()'d in the -ensureAdditionalCapacity: method), and that memory is no longer freed and thus leaked.

(To be clear, in the case of reallocf() in -ensureAdditionalCapacity: , the memory previously allocated gets freed when reallocf() is called, but the memory allocated by the final call to reallocf() will leak.)

The fix would be to add a -dealloc method for PBAppendableArray which free()'s the _data memory. I will issue a pull request.

Don't insert #import "ObjectivecDescriptor.pb.h" into generated code?

Hi,
I use objectivec_file_options to specify a class prefix in my proto, but the compiler inserts a runtime dependency (#import "ObjectivecDescriptor.pb.h"). As far as I can tell these are proto-compile-time only and don't need to be added to the generated code. I have a patch to fix this, will you take it?

Serialization bug on 64 bit architecture for "repeated uint32" fields

We've written an automated test (included below) that you can use to reproduce the problem. Please let us know if we've made a mistake with how we're using the field!

In the short term, the workaround I'm planning is to change to "repeated uint64" fields, which work fine.

Here's an example "test.proto" file:

package test;

message Example
{
    repeated uint32 myfield = 1;
}

Here's the test that reproduces the problem:

#import <XCTest/XCTest.h>

#import "Test.pb.h"

@interface ProtobufTests : XCTestCase

@end

@implementation ProtobufTests

- (void)testSerializationAndDeserialization
{
    NSArray *testValuesAsNumbers = @[[NSNumber numberWithUnsignedInteger:26234], [NSNumber numberWithUnsignedInteger:26235]];

    ExampleBuilder *builder = [ExampleBuilder new];
    [builder setMyfieldArray:testValuesAsNumbers];

    Example *pbMessage = [builder build];

    for (int i = 0; i < testValuesAsNumbers.count; i++) {
        XCTAssertEqual([pbMessage.myfield uint32AtIndex:i], [testValuesAsNumbers[i] unsignedIntegerValue],
                       @"Repeated primitive value at index %d is not the value it was set to", i);
    }

    NSData *serializedProtobuf = [pbMessage data];

    Example *unserializedMessage = [Example parseFromData:serializedProtobuf];

    for (int i = 0; i < testValuesAsNumbers.count; i++) {
        XCTAssertEqual([unserializedMessage.myfield uint32AtIndex:i], [testValuesAsNumbers[i] unsignedIntegerValue],
                       @"After serializing/deserializing, repeated primitive value at index %d is not the value it was set to", i);
    }
}

@end

The test passes fine when run with a 32 bit target (e.g. "iPhone Retina (4-inch)"), but fails when run on a 64 bit target (e.g. "iPhone Retina (4-inch 64-bit)") the final line with this error message:

error: -[ProtobufTests testSerializationAndDeserialization] : (([unserializedMessage.myfield uint32AtIndex:i]) equal to ([testValuesAsNumbers[i] unsignedIntegerValue])) failed: ("278373775") is not equal to ("26235") - After serializing/deserializing, repeated primitive value at index 1 is not the value it was set to

generated .m's hash code

Source code generated from the proto that includes 'enum' interferes with other class with "longValue" property.
Casting obj to NSNumber* is safer.

--- a/src/compiler/objc_primitive_field.cc
+++ b/src/compiler/objc_primitive_field.cc
@@ -763,7 +763,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
     if (ReturnsPrimitiveType(descriptor_)) {
       printer->Print(variables_,
       "[self.$list_name$ enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {\n"
-      "  hashCode = hashCode * 31 + [obj longValue];\n"
+      "  hashCode = hashCode * 31 + [(NSNumber*)obj longValue];\n"
       "}];\n");

     } else {

class_prefix

I'd like to add class prefix like :

option (google.protobuf.objectivec_file_options).class_prefix = "DE";

but protoc return this error:

authorization.proto:4:8: Option "(google.protobuf.objectivec_file_options)" unknown.

have the compiler add an NSDictionary for every enum type

Even though Objective-C is a dynamic language, it's basically impossible to get an enum value given its name as an NSString because an Objective-C/C enum is essentially just an integer (whereas in Java, it can easily be done via the reflection API).

But in the context of protobuf, this problem can be solved by having the compiler add an NSDictionary in which the keys are enum names (NSString) and values are enum values. It could add another dictionary to map enums to their names.

Will you support disable readonly property

The following example shows the limitation of current protobuf-objc's implementation.
If there is a message Car:
message Car
{
optional string brand = 1;
}
the output of objc class will be like this:
@interface Car : PBGeneratedMessage {
@Private
BOOL hasBrand_:1;
NSString* brand;
}

  • (BOOL) hasBrand;
    @Property (readonly, strong) NSString* brand;

Now you got a car,
Car *car
If you want to change the car's name, you should do this:
car = [[car tobuilder] setBrand:@"new car brand"].build;
But the new car's memory address is different from the original one.
You can not keep the same pointer(memory address) of car when set a new value for brand by syntax:
[car setBrand:@"new car brand"], because brand is readonly;

Will you support this feature?

Duplicate declaration of method 'mergeFrom:'

In proto I have a field named "from", and thus I have 2 methods in generated files:

- (Proto1Builder*) mergeFrom:(Proto1*) other; <<< HERE
- (Proto1Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
- (Proto1Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry;
...
- (BOOL) hasFrom;
- (Proto2*) from;
- (Proto1Builder*) setFrom:(Proto2*) value;
- (Proto1Builder*) setFromBuilder:(Proto2Builder*) builderForValue;
- (Proto1Builder*) mergeFrom:(Proto2*) value; <<< HERE
- (Proto1Builder*) clearFrom;

As a temporary solution I renamed these problematic fields.

./build.sh - wrong path for autogen.sh

Following the instructions to run the build.sh file I get:

./build.sh: line 5: ./autogen.sh: No such file or directory

adding:

cd ..

to the start of the build.sh file appears to fix it. Perhaps the build.sh file was recently moved?

Build Error at common.h

Hi there,

(I'm new to github so I hope this is the right way to place a question.)

I am running Xcode 6.1.1 under OS X Yosemite 10.10.2 and wanted to give your ObjC Protobuf implementation a try. I followed your instructions under „Building the Objective-C Protobuf compiler“ 1:1 but got the following error at ./build.sh:

[…]
checking for strchr... yes
checking for strerror... yes
checking for strtol... yes
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.

I cannot even find the above mentioned 'common.h' in the github files (under stubs there are only three files: hash.h, strutil.h, substitute.h) – so I would NOT expect that setting the above suggested flags to change anything. Do I need to download the entire Protobuf C++ (?) library from google?

Any help would be appreciated.

Can't build protobuf-objc compiler

I'm having protobuf 2.6.1 currently installed but now i need objective-c support too.
So i've cloned repo, built and installed protobuf-objc using ./scripts/build.sh as described.

Anyway there is some problem as nothing in build and installed:

MBA-Anton:protobuf-objc asmirnov$ ./scripts/build.sh 
+ ./autogen.sh
glibtoolize: putting auxiliary files in `.'.
glibtoolize: copying file `./ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
glibtoolize: copying file `m4/libtool.m4'
glibtoolize: copying file `m4/ltoptions.m4'
glibtoolize: copying file `m4/ltsugar.m4'
glibtoolize: copying file `m4/ltversion.m4'
glibtoolize: copying file `m4/lt~obsolete.m4'
src/compiler/Makefile.am:5: warning: source file 'google/protobuf/objectivec-descriptor.pb.cc' is in a subdirectory,
src/compiler/Makefile.am:5: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
+ ./configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
checking build system type... x86_64-apple-darwin14.3.0
checking host system type... x86_64-apple-darwin14.3.0
checking target system type... x86_64-apple-darwin14.3.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking C++ compiler flags...... use user-supplied: -I/usr/local/include
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin14.3.0 file names to x86_64-apple-darwin14.3.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin14.3.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin14.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin14.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for inttypes.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for working memcmp... yes
checking for working strtod... yes
checking for ftruncate... yes
checking for memset... yes
checking for mkdir... yes
checking for strchr... yes
checking for strerror... yes
checking for strtol... yes
checking google/protobuf/stubs/common.h usability... yes
checking google/protobuf/stubs/common.h presence... no
configure: WARNING: google/protobuf/stubs/common.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: google/protobuf/stubs/common.h: proceeding with the compiler's result
checking for google/protobuf/stubs/common.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/compiler/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
+ make clean
Making clean in src/compiler
 rm -f protoc-gen-objc
rm -rf .libs _libs
rm -f *.o
rm -f *.lo
rm -rf .libs _libs
rm -f *.lo
+ make -j8
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src/compiler
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cc
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_enum_field.o -MD -MP -MF .deps/objc_enum_field.Tpo -c -o objc_enum_field.o objc_enum_field.cc
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_file.o -MD -MP -MF .deps/objc_file.Tpo -c -o objc_file.o objc_file.cc
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_message_field.o -MD -MP -MF .deps/objc_message_field.Tpo -c -o objc_message_field.o objc_message_field.cc
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_enum.o -MD -MP -MF .deps/objc_enum.Tpo -c -o objc_enum.o objc_enum.cc
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_generator.o -MD -MP -MF .deps/objc_generator.Tpo -c -o objc_generator.o objc_generator.cc
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_primitive_field.o -MD -MP -MF .deps/objc_primitive_field.Tpo -c -o objc_primitive_field.o objc_primitive_field.cc
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_extension.o -MD -MP -MF .deps/objc_extension.Tpo -c -o objc_extension.o objc_extension.cc
mv -f .deps/main.Tpo .deps/main.Po
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_helpers.o -MD -MP -MF .deps/objc_helpers.Tpo -c -o objc_helpers.o objc_helpers.cc
mv -f .deps/objc_generator.Tpo .deps/objc_generator.Po
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_field.o -MD -MP -MF .deps/objc_field.Tpo -c -o objc_field.o objc_field.cc
mv -f .deps/objc_enum.Tpo .deps/objc_enum.Po
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objc_message.o -MD -MP -MF .deps/objc_message.Tpo -c -o objc_message.o objc_message.cc
mv -f .deps/objc_enum_field.Tpo .deps/objc_enum_field.Po
g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT objectivec-descriptor.pb.o -MD -MP -MF .deps/objectivec-descriptor.pb.Tpo -c -o objectivec-descriptor.pb.o `test -f 'google/protobuf/objectivec-descriptor.pb.cc' || echo './'`google/protobuf/objectivec-descriptor.pb.cc
mv -f .deps/objc_extension.Tpo .deps/objc_extension.Po
mv -f .deps/objc_message_field.Tpo .deps/objc_message_field.Po
mv -f .deps/objc_primitive_field.Tpo .deps/objc_primitive_field.Po
mv -f .deps/objc_file.Tpo .deps/objc_file.Po
mv -f .deps/objc_field.Tpo .deps/objc_field.Po
mv -f .deps/objc_helpers.Tpo .deps/objc_helpers.Po
mv -f .deps/objectivec-descriptor.pb.Tpo .deps/objectivec-descriptor.pb.Po
mv -f .deps/objc_message.Tpo .deps/objc_message.Po
/bin/sh ../../libtool  --tag=CXX   --mode=link g++  -I/usr/local/include -lprotobuf -lprotoc -L/usr/local/lib -o protoc-gen-objc main.o objc_enum_field.o objc_file.o objc_message_field.o objc_enum.o objc_generator.o objc_primitive_field.o objc_extension.o objc_helpers.o objc_field.o objc_message.o objectivec-descriptor.pb.o  
libtool: link: g++ -I/usr/local/include -o protoc-gen-objc main.o objc_enum_field.o objc_file.o objc_message_field.o objc_enum.o objc_generator.o objc_primitive_field.o objc_extension.o objc_helpers.o objc_field.o objc_message.o objectivec-descriptor.pb.o -Wl,-bind_at_load  /usr/local/lib/libprotoc.dylib /usr/local/lib/libprotobuf.dylib -lz -L/usr/local/lib
+ make install
Making install in src/compiler
 ../.././install-sh -c -d '/usr/local/bin'
  /bin/sh ../../libtool   --mode=install /usr/bin/install -c protoc-gen-objc '/usr/local/bin'
libtool: install: /usr/bin/install -c protoc-gen-objc /usr/local/bin/protoc-gen-objc
make[2]: Nothing to be done for `install-data-am'.
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
MBA-Anton:protobuf-objc asmirnov$ protoc --version
libprotoc 2.6.1

Adding WatchOS support for Obj-C

Is there anyway to add WatchOS2 support to Protocol Buffer - Objective-C? CocoaPods 0.38 added support for WatchOS however, in order for Pods to be usable with WatchOS2, they require the pod Author/Maintainer to add the following line in the Podspec:
s.watchos.deployment_target = '2.0' to https://github.com/alexeyxo/protobuf-objc/blob/master/ProtocolBuffers.podspec

This is outlined here: http://blog.cocoapods.org/CocoaPods-0.38/ (under the heading WatchOS). would this be possible?

.proto.h & .proto.m file compile error

when i generate .h & .m file accord to .proto, there are some errors:
Xltire_protocol.pb.m:1056:32: error: type of property 'result' ('MemberList ') does not match type of accessor 'result' ('SInt32' (aka 'int'))
@Property (strong) MemberList
result;
^
In file included from /Users/jay/study/SourceCode/TimSunSales/TimSun/TimSun/Models/GoogleProto/Xltire_protocol.pb.m:3:
/Users/jay/study/SourceCode/TimSunSales/TimSun/TimSun/Models/GoogleProto/Xltire_protocol.pb.h:385:1: note: declared here

  • (SInt32) result;
    ^
    /Users/jay/study/SourceCode/TimSunSales/TimSun/TimSun/Models/GoogleProto/Xltire_protocol.pb.h:386:1: error: type of setter must be void
  • (MemberListBuilder_) setResult:(SInt32) value;
    ^
    /Users/jay/study/SourceCode/TimSunSales/TimSun/TimSun/Models/GoogleProto/Xltire_protocol.pb.m:1056:32: warning: type of property 'result' does not match type of accessor 'setResult:'
    @Property (strong) MemberList_ result;
    ^
    In file included from /Users/jay/study/SourceCode/TimSunSales/TimSun/TimSun/Models/GoogleProto/Xltire_protocol.pb.m:3:
    /Users/jay/study/SourceCode/TimSunSales/TimSun/TimSun/Models/GoogleProto/Xltire_protocol.pb.h:386:1: note: declared here
  • (MemberListBuilder*) setResult:(SInt32) value;
    ^
    /Users/jay/study/SourceCode/TimSunSales/TimSun/TimSun/Models/GoogleProto/Xltire_protocol.pb.m:1063:17: warning: incompatible pointer to integer conversion assigning to 'SInt32' (aka 'int') from 'MemberList *' [-Wint-conversion]
    self.result = [[MemberList alloc] init];
    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/jay/study/SourceCode/TimSunSales/TimSun/TimSun/Models/GoogleProto/Xltire_protocol.pb.m:1071:15: warning: incompatible pointer to integer conversion assigning to 'SInt32' (aka 'int') from 'MemberList *' [-Wint-conversion]
    self.result = [[MemberList alloc] init];

Undefined symbols for architecture x86_64

When i build with Xcode I get:

Ld /Users/tarandeep/Library/Developer/Xcode/DerivedData/GT-doybmghqampnllbmnubwspapuhbj/Build/Products/Debug-iphonesimulator/GT.app/GT normal x86_64
cd /Users/tarandeep/Documents/GT/GT
export IPHONEOS_DEPLOYMENT_TARGET=8.4
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -L/Users/tarandeep/Library/Developer/Xcode/DerivedData/GT-doybmghqampnllbmnubwspapuhbj/Build/Products/Debug-iphonesimulator -F/Users/tarandeep/Library/Developer/Xcode/DerivedData/GT-doybmghqampnllbmnubwspapuhbj/Build/Products/Debug-iphonesimulator -F/Users/tarandeep/Documents/GT/GT/Pods/GoogleMaps/Frameworks -filelist /Users/tarandeep/Library/Developer/Xcode/DerivedData/GT-doybmghqampnllbmnubwspapuhbj/Build/Intermediates/GT.build/Debug-iphonesimulator/GT.build/Objects-normal/x86_64/GT.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lc++ -licucore -lz -framework AVFoundation -framework Accelerate -framework CoreBluetooth -framework CoreData -framework CoreGraphics -framework CoreLocation -framework CoreText -framework GLKit -framework GoogleMaps -framework ImageIO -framework OpenGLES -framework QuartzCore -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.4 -framework CoreFoundation -Xlinker -dependency_info -Xlinker /Users/tarandeep/Library/Developer/Xcode/DerivedData/GT-doybmghqampnllbmnubwspapuhbj/Build/Intermediates/GT.build/Debug-iphonesimulator/GT.build/Objects-normal/x86_64/GT_dependency_info.dat -o /Users/tarandeep/Library/Developer/Xcode/DerivedData/GT-doybmghqampnllbmnubwspapuhbj/Build/Products/Debug-iphonesimulator/GT.app/GT

Undefined symbols for architecture x86_64:
"OBJC_CLASS$_PBExtensionRegistry", referenced from:
objc-class-ref in Level.pb.o
"OBJC_CLASS$_PBGeneratedMessage", referenced from:

Repeated float field results in Objective-C syntax error in generated code

Any object with a repeated float field such as:

message ExampleObject {
    repeated float example_field = 7;
}

generates the following un-compilable code in the writeDescriptionTo:withIndent: methods

[output appendFormat:@"%@%@: %@\n", indent, @"exampleField", @((Float32)value)];

The above line needs to be edited to read

    [output appendFormat:@"%@%@: %@\n", indent, @"matcherWeights", @((Float32)[value floatValue])];

(or something similar). This is on the latest commit from master.

protobuf-objc doesn't support packed noinline repeated fields

If I generate a message using nanopb (protocol buffers for embedded systems) and a repeated uint32 field, I can use protoc --decode at the command line to parse the resulting message. However, parsing the resulting message via protobuf-objc does not work; it turns out as an unknown field. Generating the message via protobuf-objc will parse on both nanopb and protobuf-objc, however, so the issue appears to be entirely on decode.

Specifically, I see a tag of '0x2A' (42) in the nanopb-generated message, but I see a tag of '0x28' (40) in the protobuf-objc generated one. nanopb and protoc seem to parse both appropriately, but protobuf-objc does not. Digging deeper, this is because tag 42 gets parsed as a PackedPrimitiveNoInline in cpp or java generated parsers (or nanopb), where 40 does not. protobuf-objc seems only to support RepeatedPrimitive, not PackedPrimitiveNoInline.

64-bit support

Sorry that I haven't responded to the other github issue, will do once my project hand-in here is over, but I just tried to compile for the 64-bit iPhone and it broke everything. I am pretty sure that the main problem are the ProtoBuffs.
Not really an issue but wanted to mention it here.

Trouble compiling for 64bit OSX

I've added this to a framework for an OS X & iOS app, however i'm having trouble building it for the App Stores.
I get the error ld: symbol(s) not found for architecture arm64 when trying to build for iOS and a similar x86_64 error for OS X.
Is there a reason this wouldn't compile for 64 bit?

Thanks

Redefinition of 'Type' as different kind of symbol

Hi,
I'm facing the error message "Redefinition of 'CommonInfo' as different kind of symbol" after generation of source code for protobuf message.

First proto file source upload_data.proto:

package Project.Protocol;
import "common_info.proto";

message UploadDataRequest
{
    optional string ServiceId = 1;
    repeated CommonInfo CommonInfoData = 2;
};

Second proto file source common_info.proto:

package Project.Protocol;

message MultiValue
{
    optional string Property = 1;
    optional string Value = 2;
    optional string Label = 3;
};

message CommonInfo
{
    optional string Id = 1;
    optional bytes Data = 2;
    repeated MultiValue Properties = 3;
};

message CommonInfoRequest
{
    optional string ServiceId = 1;
    repeated CommonInfo Data = 2;
};

Generated code contains forward declarations:

#import "Common_info.pb.h"
// @@protoc_insertion_point(imports)

@class CommonInfo;
@class CommonInfoBuilder;
@class CommonInfoRequest;

I suppose that this is somehow related to forward declarations. Could you please advise how to fix it and make generated code compilable?

Example Project does not compile / Cannot find PB symbols from ProtocolBuffers when compiling framework

Hi

I'm using Xcode 6.3.2

When cloning repository and trying to compile the Example project, I get this reference error in descriptor.pb.h
screen shot 2015-05-27 at 11 30 48 am 1

I've originally tried to include ProtocolBuffers in my own dynamic framework just by adding the ProtocolBuffers project file to my dynamic framework project and then linking the libProtocolBuffers in the link build phase.
Every time during compilation it references some PB symbols it cannot find them.

Using your ProtocolBuffers for swift works in terms of referencing but then the generated classes are unusable in objective-C because not visible to objective-C (see my other issue in protobuf-swift alexeyxo/protobuf-swift#65)

Add class prefix

Is any way to add common class prefix to all protobuf messages?

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.