Huge API and Struct files generated, will not build

BonkBonk USMember
edited October 2017 in Objective Sharpie

I'm attempting to walk through this guide:

developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/walkthrough/

trying to create bindings for this github project:

github.com/lminhtm/LMGaugeView

Using Sharpie 3.4.

I am running into the following issues:

  1. I cannot generate a Fat binary with the architectures i386 armv7 x86_64 arm64 because I am building against iOS11. I can only generate a Fat binary with architectures x86_64 and arm64, attempting the others gives me the error message "invalid iOS deployment version, iOS 10 is the max deployment target for 32-bit targets". Is this expected?

  2. When I then use Sharpie I am able to generate the API and Struct files, however, each of these files are huge, with Structs ending up at 24K+ lines, and API 54K+ lines. I followed a youtube tutorial as well and the output he got was about 200 or so lines, so the fact that mine are so huge makes me think something is going on. His tutorial wasn't for my same Objective-C project but I even tried the same one he did and ended up with the same result.

  3. The Struct file ends up have over 7K errors, and I see countless lines that look something like:

    // extern long double strtold (const char *, char **);
    [DllImport("__Internal")]
    [Verify(PlatformInvoke)]
    static extern unsafe [unsupported Builtin: long double] strtold(sbyte*, sbyte**);
    

Where it's missing identifier names and has this [unsupported Builtin: piece I don't understand.

I can provide more details if needed!

Answers

  • JasperJianJasperJian USMember ✭✭

    I have the same issue, have you figured out how to resolve this issue yet?

  • JasperJianJasperJian USMember ✭✭

    I also followed the walkthrough on Xamarin and followed a similar walkthrough on Youtube and both produced the same result. Someone please help :(

  • BonkBonk USMember

    @JasperJian said:
    I also followed the walkthrough on Xamarin and followed a similar walkthrough on Youtube and both produced the same result. Someone please help :(

    Hey Jasper,

    I cant post the link, but find "objc-automatic" on github.

    Its basically magic and does everything for you, make sure to watch the youtube vids to understand how to use it but its very easy. Only works with Objective-C though, so no swift.

  • JasperJianJasperJian USMember ✭✭

    Cool thanks! Exactly what I needed!

  • ChrisvanwykChrisvanwyk USXamarin Team, University, XamUProfessors, Developer Group Leader Xamurai

    Hi @JasperJian & @Bonk

    Here are the steps I ran to bind this library successfully:

    1. mkdir LMGaugeViewBinding

    2. cd LMGaugeViewBinding

    3. sharpie pod init ios LMGaugeView

    4. sharpie pod bind (After this Sharpie's work is done)

    5. cd Binding

    6. lipo -info LMGaugeView.framework/LMGaugeView (This returned Architectures in the fat file: LMGaugeView.framework/LMGaugeView are: armv7 arm64)

    7. Create your X.I binding project and X.I test project.

    8. Add the LMGaugeView.framework from the Binding folder in step 5 to your Binding projects Native References

    9. Remove / comment out the [Verify(ConstantsInterfaceAssociation)] Interface from the generated LMGaugeView_ApiDefinitions.cs file in the Binding folder in step 5. You do not need this.

    10. Copy this updated definition into your Bindings Project ApiDefinition.cs file.

    11. Reference the X.I binding project in your X.I test project.

    12. Add this code to your test project's ViewDidLoad() method:
      public override void ViewDidLoad() {
      base.ViewDidLoad();
      LMGaugeView gaugeView = new LMGaugeView();
      gaugeView.Frame = View.Bounds;
      View.Add(gaugeView);
      }

    13. Run the app on your device (armv7 arm64 only targeted at this point)

    There are a few pre-requisites - Sharpie must be updated and you need an up to date Ruby install and CocoaPods gem.

    Hope this helps for future reference.

    Best

Sign In or Register to comment.