Objective Sharpie dosen't provide bindings for .framework file

maiqmaiq DEMember
edited May 2015 in Objective Sharpie

Hello,

I just tried to use Objective Sharpie to create bindings for a third party .framework.
But it is not providing bindings for the classes and methods in the headers.
It just generated some bindings for a few exceptions and enums.
I used the comand:

sharpie bind
-framework myframework.framework
-sdk iphoneos 8.3

Any suggestions?

Answers

  • abockabock USXamarin Team, Insider Xamurai

    If the framework you are trying to bind is open source, I could give you better direction for binding if you let me know what it is. Without knowing the project or any other details, I can only give you a more detailed explanation of what the -framework option does.

    Binding support for frameworks is based on proper framework design convention. It's likely the framework you are trying to bind is not structured in the conventional format, which should be: <FX_NAME>.framework/Headers/<FX_NAME>.h

    Note that a .framework is not a file, rather a directory. It just appears as a file in Finder. If you explore it on the command line you should see files under the .framework directory.

    Further, <FX_NAME>.h conventionally should be considered an "umbrella" header which takes care of #importing other headers for you. If it does not, then Objective Sharpie may not parse the right contents.

    If you have a poorly defined framework (which I suspect you do), then you'll need to dive into the framework to figure out the right arguments to pass to get it to parse (and discard the -framework option, which is of no use in that case).

    There is one supplemental argument that you might be able to use, but will still require you to figure out the structure of the framework. The -fx-umbrella option allows you to change the name of the umbrella header file for the framework:

    For example, if you specify sharpie bind -framework MyFramework -fx-umbrella SomeHeader.h then sharpie will look for MyFramework.framework/Headers/SomeHeader.h.

    See sharpie bind -help for more details:

      -f, -framework FRAMEWORK     Parse/bind an entire framework. Implies the '-
                                     scope' and '-c -F' options, and no input
                                     sources/headers can be specified. If the
                                     framework provides an 'Info.plist' with SDK
                                     information (DTSDKName), the '-sdk' option
                                     will be implied as well (if not manually
                                     specified).
          -fx-umbrella HEADER      The file name of the 'umbrella' header file. In
                                     a properly defined framework, the umbrella
                                     header has the same name as the framework (e.g.
                                      FrameworkName.h is the umbrella for
                                     FrameworkName.framework). A full path is not
                                     required as the path will be determined based
                                     on the framework path.
    
  • nickslnicksl USMember

    I could use some help with this to.Here's the framework i'm trying to bind https://github.com/appodeal/appodeal-ios-demo
    I was abel to create ApiDefinitions.cs and StructsAndEnums.cs kind although i dont think there right.

  • ChandraShekherChandraShekher USMember

    5

  • tuyenvtuyenv VNUniversity ✭✭✭

    Yeah, for some reasons, sharpie doesn't generate any bindings sometimes.

    In that case, just try to run sharpie again the headers files included inside the framework.

    Cheers.

Sign In or Register to comment.