PhilWherrett-5979 avatar image
0 Votes"
PhilWherrett-5979 asked WenyanZhang-MSFT commented

Can These iOS and Java Libraries Have Bindings to a Xamarin.Forms App?

Hi Xamarin Experts,

Coming from a purely Windows/.NET background, I'm struggling to work out if the following two iOS and Java/Android libraries can have bindings to a Xamarin.Forms app:



I have been trying to follow the steps for iOS here binding-swift, but haven't had much success to date. I haven't attempted Java/Andoid one as yet.

Any feedback or suggestions would be most welcome.

· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It needs four steps. May I ask about your step progress and is there any error messages?

  1. Building the native library

  2. Preparing the Xamarin metadata, which enables Xamarin tooling to generate C# classes

  3. Building a Xamarin binding library using the native library and the metadata

  4. Consuming the Xamarin binding library in a Xamarin application

0 Votes 0 ·

Hi There,

Thanks for your response. As a complete noob to Xcode and Macs I'm at step 1 trying to build the library and generate the Swift header!

There are no errors - the source code builds, but I can't locate/find any framework headers. I assume I therefore need to add @objc attributes in the source code as per this:

If you have access to the code, you can decorate the required Swift member(s) with the @objc attribute and apply a few additional rules to let the Xcode build tools know that these members should be exposed to the Objective-C world and the header.

So, how do you go about doing that? And what are the 'additional rules' that are mentioned?

0 Votes 0 ·

This means you could add changes to the third-party source code, 'additional rules' depends on what you want.
I check this mcumgr-ios repository , it use cocopods, you could download it, and run pod install. Its header is in the McuManager folder.

0 Votes 0 ·
Show more comments
WenyanZhang-MSFT avatar image WenyanZhang-MSFT PhilWherrett-5979 ·

The mcumgr-ios library is not really well formed and it is a little complicated to bind. It may occur some errors when parsing the API definitions. So, we recommend assisting support case or hiring a consultant. This is a paid business, you could choose it.

0 Votes 0 ·

0 Answers