Latest 1.0.4
Homepage https://github.com/silver6wings/SilverProtoBuffer
License MIT
Platforms ios 8.0, requires ARC
Authors

SilverProtobuffer

Google Protocol Buffer v2.6 API auto packer

Background

TODO

Benefit

Using AFNetworking call API:

Using SILManager:

Using Python-packer:

How to use:

  • Step 1: Prepared the .json file which contains the API spec definition and the related .proto files which contains the protobuf messages that API spec needs and put all of them into /python-packer/input.
  • Step 2: Execute the python main.py and generate the code you need. If found some errors, please fix them and try again.
  • Step 3: Import the iOS or Android SDK files into your project.
  • Step 4: If your iOS project is default set to ARC, you need to add MRC flag "-fno-objc-arc" to the *.pbobjc.m at your build target because the fils generated by protobuf was default in MRC)
  • Step 5: Put the generated code into your project.
  • Step 6: Done! just try call the method in your code to request data from an API you defined.

Project contains:

  • java-android
    • Http API Request Android Framework
    • Demo of silver ProtoBuffer usage
  • objc-ios
    • Http API Request iOS Framework
    • Demo of silver ProtoBuffer usage
  • python-packer
    • API packer python script
    • Input Container
    • Output Demo
  • server-sample
    • A server sample code based on Spring Boot Framework that can be used for the demos above

Notice:

  • iOS Part
    • TODO prefix
    • TODO id

Notes:

  • iOS SDK
    • The requester part was based on AFNetworking, but AFNetworking only support sending the NSDictionary as parameters, so I modified some code of it to support sending the serialized protobuf binary data.
  • Android SDK
    • Based on AsyncHttp, because AsyncHttp didn’t support cache, so currently didn’t add the cache related feature.
  • For the packer
    • There have some code to remove and add the "objc_class_prefix". Because there Google Protobuf 2 complier didn’t support iOS prefix but in the Google Protobuf 3 support it.
    • Need to install both protobuf and [email protected] in brew. Because the .java files generated under the brew protobuf 3.x environment can’t be integrated into protobuf 2.x projects, so there are some code do the link and unlink.
    • Now didn’t support the "import" in .proto file so need to fix some build break in the generated files.

Problems found

  • Protobuf import syntax support

Versions

Apr.2017

  • Release the iOS framework

About

Email: [email protected]

By Junchao/silver6wings

Latest podspec

{
    "name": "SilverProtoBuffer",
    "version": "1.0.4",
    "summary": "A networking framework based on Google Protobuf v2.6 & AFNetworking that can help you pack APIs",
    "cocoapods_version": ">= 1.0",
    "homepage": "https://github.com/silver6wings/SilverProtoBuffer",
    "license": "MIT",
    "authors": {
        "silver6wings": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/silver6wings/SilverProtobuffer.git",
        "tag": "1.0.4"
    },
    "requires_arc": true,
    "source_files": [
        "objc-ios/SILProtobuffer/SILProtobuffer.h",
        "objc-ios/SILProtobuffer/SILAPI.h",
        "objc-ios/SILProtobuffer/SILManager.{h,m}",
        "objc-ios/SILProtobuffer/SILParser.{h,m}",
        "objc-ios/SILProtobuffer/SILRequester.{h,m}"
    ],
    "subspecs": [
        {
            "name": "AFNetworking+Silver",
            "source_files": "objc-ios/AFNetworking/*.{h,m}"
        },
        {
            "name": "Protobuf260",
            "requires_arc": false,
            "source_files": [
                "objc-ios/GoogleProtobuf/*.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/Any.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/Api.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/Duration.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/Empty.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/FieldMask.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/SourceContext.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/Struct.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/Timestamp.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/Type.pbobjc.{h,m}",
                "objc-ios/GoogleProtobuf/protobuf/Wrappers.pbobjc.{h,m}"
            ],
            "exclude_files": "objc-ios/GoogleProtobuf/GPBProtocolBuffers.m"
        }
    ]
}

Pin It on Pinterest

Share This