Hi ma trying to create the following declaration in a iOS Binding project. The source Objective C declaration is the following
@interface LeBlutrackerDevice : LeDevice <MKAnnotation>
{
CLLocationCoordinate2D _coord;
}
@property (nonatomic,readonly,copy) NSString *title;
@property (nonatomic,readonly,copy) NSString *subtitle;
@property (nonatomic,readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, strong) NSString *svInfo;
@property (nonatomic, strong) NSString *navInfo;
@property (nonatomic,readonly) enum LE_DEVICE_STATE state;
@property (nonatomic,strong) id <LeBlutrackerDeviceDelegate> delegate;
@property (readonly) BOOL bcKeyEnabled;
- (BOOL) writeBroadcastKey: (NSData *) key;
@end
This is what i have in the ApiDefinition.cs
[Model, BaseType (typeof (LeDevice))]
public partial interface LeBlutrackerDevice : MKAnnotation
{
[Export ("title", ArgumentSemantic.Copy)]
string Title { get; }
[Export ("subtitle", ArgumentSemantic.Copy)]
string Subtitle { get; }
[Export ("coordinate")]
CLLocationCoordinate2D Coordinate { get; }
[Export ("svInfo", ArgumentSemantic.Retain)]
string SvInfo { get; set; }
[Export ("navInfo", ArgumentSemantic.Retain)]
string NavInfo { get; set; }
[Export ("state")]
LE_DEVICE_STATE State { get; }
[Export ("delegate", ArgumentSemantic.Retain)]
LeBlutrackerDeviceDelegate Delegate { get; set; }
[Export ("bcKeyEnabled")]
bool BcKeyEnabled { get; }
[Export ("writeBroadcastKey:")]
bool WriteBroadcastKey (NSData key);
}
And i get the following errors
Target GenerateBindings:
ApiDefinition.cs(309,48): error CS0527: Type `MonoTouch.MapKit.MKAnnotation' in interface list is not an interface
ApiDefinition.cs(313,10): warning CS0108: `SticknFind.LeBlutrackerDevice.Title' hides inherited member `MonoTouch.MapKit.MKAnnotation.Title'. Use the new keyword if hiding was intended
ApiDefinition.cs(316,10): warning CS0108: `SticknFind.LeBlutrackerDevice.Subtitle' hides inherited member `MonoTouch.MapKit.MKAnnotation.Subtitle'. Use the new keyword if hiding was intended
ApiDefinition.cs(319,26): warning CS0108: `SticknFind.LeBlutrackerDevice.Coordinate' hides inherited member `MonoTouch.MapKit.MKAnnotation.Coordinate'. Use the new keyword if hiding was intended
Anyone attempting to create a binding for SticknFind SDK? please let me know since I am more than happy to post the final result on GitHub.
If I try it to inherit from IMKAnnotation i get the following error
btouch: No [Export] attribute on property SticknFind.LeBlutrackerDevice.Coordinate
Task "BTouch" execution -- FAILED
You want to inherit from the the interface not the type, that's what causing the first CS0527 error.
It's the interface that's decorated with the [Protocol]
attribute (so it will match the ObjC declaration). It will also solve the later CS0108 errors since the type has extra members not part of the protocol.
So this should solve it:
[BaseType (typeof (LeDevice))]
public partial interface LeBlutrackerDevice : IMKAnnotation {
...
}