Reputation: 2557
I'm attempting to walk through this guide:
https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/walkthrough/
trying to create bindings for this github project:
https://github.com/lminhtm/LMGaugeView
Using Sharpie 3.4.
I am running into the following issues:
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?
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.
The Struct file ends up have over 7K errors, and I see countless lines that look something like:
// extern long double tanhl (long double) __attribute__((const)) __attribute__((nothrow));
[DllImport ("__Internal")]
[Verify (PlatformInvoke)]
static extern [unsupported Builtin: long double] tanhl ([unsupported Builtin: long double]);
Where it's missing identifier names and has this [unsupported Builtin: piece I don't understand.
There's also countless references to other iOS versions, and watchOS and TV, so it seems like it's trying to create the API and Structs for every OS and version there is, which makes sense why the files would be so large. Here's a small snippet from the Struct file:
// extern CGPathRef _Nullable CGPathCreateCopyByTransformingPath (CGPathRef _Nullable path, const CGAffineTransform * _Nullable transform) __attribute__((availability(ios, introduced=5.0))) __attribute__((cf_audited_transfer));
[iOS (5,0)]
[DllImport ("__Internal")]
[Verify (PlatformInvoke)]
[return: NullAllowed]
static extern unsafe CGPathRef* CGPathCreateCopyByTransformingPath ([NullAllowed] CGPathRef* path, [NullAllowed] CGAffineTransform* transform);
// extern CGMutablePathRef _Nullable CGPathCreateMutableCopy (CGPathRef _Nullable path) __attribute__((availability(ios, introduced=2.0))) __attribute__((cf_audited_transfer));
[iOS (2,0)]
[DllImport ("__Internal")]
[Verify (PlatformInvoke)]
[return: NullAllowed]
static extern unsafe CGMutablePathRef* CGPathCreateMutableCopy ([NullAllowed] CGPathRef* path);
// extern CGMutablePathRef _Nullable CGPathCreateMutableCopyByTransformingPath (CGPathRef _Nullable path, const CGAffineTransform * _Nullable transform) __attribute__((availability(ios, introduced=5.0))) __attribute__((cf_audited_transfer));
[iOS (5,0)]
[DllImport ("__Internal")]
[Verify (PlatformInvoke)]
[return: NullAllowed]
static extern unsafe CGMutablePathRef* CGPathCreateMutableCopyByTransformingPath ([NullAllowed] CGPathRef* path, [NullAllowed] CGAffineTransform* transform);
I know these files should be way smaller, especially since the Objective-C code is a single header file. What could I be doing wrong here?
I can provide more details if needed!
Upvotes: 3
Views: 1849
Reputation: 3101
I quickly checked the LMGaugeView pod that you mentioned.
Turns out, for that you have to have latest XCode and Sharpie (3.4 is current version).
You can update sharpie by running sharpie update
. Then you can generate a binding.
I've tried and it seems to work just fine, see yourself: youtube.com/watch?v=g7qQJnMxubU&feature=youtu.be
Shameless plug - tool I used in video is a wrapper for sharpie I use for Xamarin.iOS bindings - objc-automatic.
Upvotes: 3