What do do after running sharpie pod bind? Documentation is extremely lacking

PaulBrennerPaulBrenner USUniversity ✭✭

Hello, I'm trying to bind CKViewPager (ideally I'd want to bind the swift version since it's more up to date, but binding swift projects looks insanely complex).

The issue I'm running into is after binding it with sharpie pod bind, it creates two cs files and a .framework file. The documentation doesn't say what to do after that. And every tutorial I've found uses a .a file to create the Xamarin.iOS binding, but the command doesn't create a .a file.

Anyone know what to do next after using sharpie pod bind to make a binding?

Thanks

Posts

  • NashZhouNashZhou USMember ✭✭✭
    edited June 10

    I'll document my account of trying to bind an iOS library. Objective Sharpie doesn't create, and isn't suppose to create a .a file. Objective Sharpie only creates 2 of the files you unfortunately. You'll need Xcode in order to get the .a file. Here is a video I found off YouTube that shows how you get the .a file. (It's in the first section of the video)

    Once you get the .a file from Xcode as well as the 2 files (ApiDefinitions.cs and StructsAndEnums.cs), create an iOS binding library and put all the files in that binding library. Your ApiDefinitions and StructsAndEnums files replace the existing files. The .a file goes in the Native Reference folder. The video above, which is fairly recent, really didn't help me with the next parts of the binding.

    Theoretically once you have all 3 files in your bindings, you should be able to hit Run and complete the binding! No...You get errors, and if you don't get an error I say good for you! You need to first look at every Verify attribute in your APIDefinitions and check to make sure Objective Sharpie did its job. I had to change some of Objective Sharpie's MethodToProperty hints because it turned some of the methods in the original library into properties (Brush up on your Objective C knowledge). After you run your library a couple of times, fixing whatever is the error, you should get a working library! All you have to do is get that dll file your binding library just produced, open your iOS project and add that dll into your References folder!

    No...I could get my library to run (which is great), but when I add a reference to my binding library in my actual project I get these "The native class hasn't been loaded" errors. None of those guys helped with what I had because I didn't have this linkwith.cs file (I don't blame them either cause the discussion was from 2013). I had to go back into my binding library, right click on my .a file, click properties, and turn SmartLink to true. (Yes I played with every option I could find until I got a working file)

    You might get more errors than I did or you might get less, though that was my experience binding an iOS library.

  • PaulBrennerPaulBrenner USUniversity ✭✭

    Thanks @NashZhou! That video was very helpful

Sign In or Register to comment.