MetaWear in Xamarin.iOS

Hi

MbientLab has an SDK for iOS that I want to integrate into Xamarin.iOS, however it's not working.

I did the following:
On a mac I've initialized MetaWear from CocoaPods using Objective Sharpie

sharpie pod init ios MetaWear

It downloaded all files needed for MetaWear correctly. Next I tried command:

sharpie pod bind

Which seemed to be working fine at first (both Bolts and FastCoding are build correctly) but at the end it fails:

Parsing 1 header files...
While building module 'MetaWear' imported from /private/var/folders/st/jd75ngq14j5gkh7btj5hcnhm0000gn/T/com.xamarin.ObjectiveSharpie/a4088a429d154715a57f5b20ad6b30fc.h:1:
In file included from <module-includes>:1:
In file included from /Users/vans/Documents/MyMetaWearSDK/build/Release-iphoneos/MetaWear/MetaWear.framework/Headers/MetaWear-umbrella.h:13:
/Users/vans/Documents/MyMetaWearSDK/build/Release-iphoneos/MetaWear/MetaWear.framework/Headers/BFTask+MBLExtensions.h:36:9: fatal error: 
      'Bolts/Bolts.h' file not found
#import <Bolts/Bolts.h>
        ^
/private/var/folders/st/jd75ngq14j5gkh7btj5hcnhm0000gn/T/com.xamarin.ObjectiveSharpie/a4088a429d154715a57f5b20ad6b30fc.h:1:9: fatal error: 
      could not build module 'MetaWear'
@import MetaWear;
 ~~~~~~~^~~~~~~~

Binding...
2 errors generated.
Error while processing /private/var/folders/st/jd75ngq14j5gkh7btj5hcnhm0000gn/T/com.xamarin.ObjectiveSharpie/a4088a429d154715a57f5b20ad6b30fc.h.

Submitting usage data to Xamarin...
  Submitted - thank you for helping to improve Objective Sharpie!

Done. Exiting with error code 1.

Because of this I tried binding the .h-file generated while building, like so:

sharpie bind build/Release-iphoneos/MetaWear/MetaWear.framework/Headers/MetaWear.h -sdk iphoneos

Which doesn't work either:

Parsing 1 header files...
/Users/vans/Documents/MyMetaWearSDK/build/Release-iphoneos/MetaWear/MetaWear.framework/Headers/MetaWear.h:36:9: fatal error: 
      'MetaWear/MBLAccelerometer.h' file not found
#import <MetaWear/MBLAccelerometer.h>
        ^

Binding...
1 error generated.
Error while processing /Users/vans/Documents/MyMetaWearSDK/build/Release-iphoneos/MetaWear/MetaWear.framework/Headers/MetaWear.h.

Submitting usage data to Xamarin...
  Submitted - thank you for helping to improve Objective Sharpie!

Done. Exiting with error code 1.
error: Clang failed to parse input and exited with code 1

As a workaround I opened MetaWear.h (and the other header-files) and altered all import-statements from #import <MetaWear/MBLFILENAME.h> to #import "MBLFILENAME.h". After trying above Command again both ApiDefinitions.cs and StructsAndEnums.cs were generated. These cannot simply be copy-pasted into VS2017 (Xamarin.iOS Binding Library) because a lot of compilation errors occur.

The type or namespace name 'MBLCalibrationAccuracy' could not be found. Are you missing an assembly reference?
The type or namespace name 'MBLBarometerBoschOversample' could not be found. Are you missing an assembly reference?
...

What am I doing wrong? How can the MetaWear-SDK be integrated into a Xamarin.iOS-project?

Best Answer

Answers

Sign In or Register to comment.