Xamarin Studio btouch 不支持的字段类型:NSUuid

Posted

技术标签:

【中文标题】Xamarin Studio btouch 不支持的字段类型:NSUuid【英文标题】:Xamarin Studio btouch unsupported type for Fields : NSUuid 【发布时间】:2016-10-08 04:12:42 【问题描述】:

我试图将制造商 Sensoro 的 obj-c 库绑定到我的 Mac 上的 Xamarin.ios,但我遇到了一个奇怪的构建错误,正如问题主题中所宣传的那样。我使用 Sharpie 3 扫描头文件。对我来说奇怪的是 NSUuid 是 Xamarin 自己的 Foundation 命名空间中的类类型,因此应该支持它,所以我不知道为什么构建过程会抱怨它。这是 ApiDefinition.cs

using System;
using CoreBluetooth;
using CoreLocation;
using Foundation;
using ObjCRuntime;

namespace SensoroBeaconKit

    [Static]
    //[Verify (ConstantsInterfaceAssociation)]
    partial interface Constants
    
        // extern NSString *const SBKBeaconInRangeStatusUpdatedNotification;
        [Field ("SBKBeaconInRangeStatusUpdatedNotification", "__Internal")]
        NSString SBKBeaconInRangeStatusUpdatedNotification  get; 

        // extern NSUuid * SBKSensoroDefaultProximityUUID;
        [Field ("SBKSensoroDefaultProximityUUID", "__Internal")]
        NSUuid SBKSensoroDefaultProximityUUID  get; 

        // extern NSString *const SBKErrorDomain;
        [Field ("SBKErrorDomain", "__Internal")]
        NSString SBKErrorDomain  get; 

        // extern NSString *const SBKBeaconBaseSettingsTransmitPowerKey;
        [Field ("SBKBeaconBaseSettingsTransmitPowerKey", "__Internal")]
        NSString SBKBeaconBaseSettingsTransmitPowerKey  get; 

        // extern NSString *const SBKBeaconBaseSettingsAdvertisingIntervalKey;
        [Field ("SBKBeaconBaseSettingsAdvertisingIntervalKey", "__Internal")]
        NSString SBKBeaconBaseSettingsAdvertisingIntervalKey  get; 

        // extern NSString *const SBKBeaconBaseSettingsEnergySavingModeKey;
        [Field ("SBKBeaconBaseSettingsEnergySavingModeKey", "__Internal")]
        NSString SBKBeaconBaseSettingsEnergySavingModeKey  get; 

        // extern NSString *const SBKBeaconBaseSettingsMeasuredPowerKey;
        [Field ("SBKBeaconBaseSettingsMeasuredPowerKey", "__Internal")]
        NSString SBKBeaconBaseSettingsMeasuredPowerKey  get; 

        // extern NSString *const SBKBeaconSensorSettingsTemperatureSamplingIntervalKey;
        [Field ("SBKBeaconSensorSettingsTemperatureSamplingIntervalKey", "__Internal")]
        NSString SBKBeaconSensorSettingsTemperatureSamplingIntervalKey  get; 

        // extern NSString *const SBKBeaconSensorSettingsLightSamplingIntervalKey;
        [Field ("SBKBeaconSensorSettingsLightSamplingIntervalKey", "__Internal")]
        NSString SBKBeaconSensorSettingsLightSamplingIntervalKey  get; 

        // extern NSString *const SBKBeaconSensorSettingsAccelerometerSensitivityKey;
        [Field ("SBKBeaconSensorSettingsAccelerometerSensitivityKey", "__Internal")]
        NSString SBKBeaconSensorSettingsAccelerometerSensitivityKey  get; 
    

    // @interface SBKBeaconID : NSObject <NSCopying>
    [BaseType (typeof(NSObject))]
    interface SBKBeaconID : INSCopying
    
        // +(instancetype)beaconIDWithProximityUUID:(NSUuid *)proximityUUID;
        [Static]
        [Export ("beaconIDWithProximityUUID:")]
        SBKBeaconID BeaconIDWithProximityUUID (NSUuid proximityUUID);

        // +(instancetype)beaconIDWithProximityUUID:(NSUuid *)proximityUUID major:(CLBeaconMajorValue)major;
        [Static]
        [Export ("beaconIDWithProximityUUID:major:")]
        SBKBeaconID BeaconIDWithProximityUUID (NSUuid proximityUUID, ushort major);

        // +(instancetype)beaconIDWithProximityUUID:(NSUuid *)proximityUUID major:(CLBeaconMajorValue)major minor:(CLBeaconMinorValue)minor;
        [Static]
        [Export ("beaconIDWithProximityUUID:major:minor:")]
        SBKBeaconID BeaconIDWithProximityUUID (NSUuid proximityUUID, ushort major, ushort minor);

        // -(BOOL)isEqualToBeaconID:(SBKBeaconID *)aBeaconID;
        [Export ("isEqualToBeaconID:")]
        bool IsEqualToBeaconID (SBKBeaconID aBeaconID);

        // @property (readonly, nonatomic) NSUuid * proximityUUID;
        [Export ("proximityUUID")]
        NSUuid ProximityUUID  get; 

        // @property (readonly, nonatomic) NSNumber * major;
        [Export ("major")]
        NSNumber Major  get; 

        // @property (readonly, nonatomic) NSNumber * minor;
        [Export ("minor")]
        NSNumber Minor  get; 

        // -(CLBeaconRegion *)CLBeaconRegion;
        [Export ("CLBeaconRegion")]
        //[Verify (MethodToProperty)]
        CLBeaconRegion CLBeaconRegion  get; 

        // +(instancetype)beaconIDFromCLBeaconRegion:(CLBeaconRegion *)region;
        [Static]
        [Export ("beaconIDFromCLBeaconRegion:")]
        SBKBeaconID BeaconIDFromCLBeaconRegion (CLBeaconRegion region);

        // -(NSString *)stringRepresentation;
        [Export ("stringRepresentation")]
        //[Verify (MethodToProperty)]
        string StringRepresentation  get; 

        // +(instancetype)beaconIDWithString:(NSString *)string;
        [Static]
        [Export ("beaconIDWithString:")]
        SBKBeaconID BeaconIDWithString (string @string);
    

    // typedef void (^SBKBeaconCompletionBlock)(NSError *);
    delegate void SBKBeaconCompletionBlock (NSError arg0);

    // @interface SBKBeacon : NSObject
    [BaseType (typeof(NSObject))]
    interface SBKBeacon
    
        [Wrap ("WeakDelegate")]
        [NullAllowed]
        SBKBeaconDelegate Delegate  get; set; 

        // @property (readwrite, nonatomic, weak) id<SBKBeaconDelegate> _Nullable delegate;
        [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
        NSObject WeakDelegate  get; set; 

        // @property (readonly, copy, nonatomic) SBKBeaconID * beaconID;
        [Export ("beaconID", ArgumentSemantic.Copy)]
        SBKBeaconID BeaconID  get; 

        // @property (readonly, copy, nonatomic) NSString * serialNumber;
        [Export ("serialNumber")]
        string SerialNumber  get; 

        // @property (readonly, assign, nonatomic) BOOL inRange;
        [Export ("inRange")]
        bool InRange  get; 

        // @property (assign, readwrite, nonatomic) NSInteger inRangeMinimumRssiWhileEntering;
        [Export ("inRangeMinimumRssiWhileEntering")]
        nint InRangeMinimumRssiWhileEntering  get; set; 

        // @property (assign, readwrite, nonatomic) NSInteger inRangeMinimumRssiWhileLeaving;
        [Export ("inRangeMinimumRssiWhileLeaving")]
        nint InRangeMinimumRssiWhileLeaving  get; set; 

        // @property (readonly, assign, nonatomic) NSInteger rssi;
        [Export ("rssi")]
        nint Rssi  get; 

        // @property (readonly, assign, nonatomic) CLProximity proximity;
        [Export ("proximity", ArgumentSemantic.Assign)]
        CLProximity Proximity  get; 

        // @property (readonly, nonatomic) CLLocationAccuracy accuracy;
        [Export ("accuracy")]
        double Accuracy  get; 

        // @property (readonly, copy, nonatomic) NSNumber * batteryLevel;
        [Export ("batteryLevel", ArgumentSemantic.Copy)]
        NSNumber BatteryLevel  get; 

        // @property (readonly, copy, nonatomic) NSString * hardwareModelName;
        [Export ("hardwareModelName")]
        string HardwareModelName  get; 

        // @property (readonly, copy, nonatomic) NSString * firmwareVersion;
        [Export ("firmwareVersion")]
        string FirmwareVersion  get; 

        // @property (readonly, nonatomic) SBKBeaconWorkMode workModel;
        [Export ("workModel")]
        SBKBeaconWorkMode WorkModel  get; 

        // -(void)connectWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("connectWithCompletion:")]
        void ConnectWithCompletion (SBKBeaconCompletionBlock completion);

        // -(void)disconnect;
        [Export ("disconnect")]
        void Disconnect ();

        // -(SBKBeaconConnectionStatus)connectionStatus;
        [Export ("connectionStatus")]
        //[Verify (MethodToProperty)]
        SBKBeaconConnectionStatus ConnectionStatus  get; 

        // @property (readonly, nonatomic) NSDictionary * baseSettings;
        [Export ("baseSettings")]
        NSDictionary BaseSettings  get; 

        // @property (readonly, nonatomic) NSDictionary * sensorSettings;
        [Export ("sensorSettings")]
        NSDictionary SensorSettings  get; 

        // @property (readonly, nonatomic) SBKBeaconSecureBroadcastInterval secureBroadcastInterval;
        [Export ("secureBroadcastInterval")]
        SBKBeaconSecureBroadcastInterval SecureBroadcastInterval  get; 

        // -(BOOL)writeProximityUUID:(NSUuid *)proximityUUID completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeProximityUUID:completion:")]
        bool WriteProximityUUID (NSUuid proximityUUID, SBKBeaconCompletionBlock completion);

        // -(BOOL)writeMajor:(NSNumber *)major minor:(NSNumber *)minor completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeMajor:minor:completion:")]
        bool WriteMajor (NSNumber major, NSNumber minor, SBKBeaconCompletionBlock completion);

        // -(BOOL)writeBaseSettings:(NSDictionary *)settings completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeBaseSettings:completion:")]
        bool WriteBaseSettings (NSDictionary settings, SBKBeaconCompletionBlock completion);

        // -(BOOL)writeSensorSettings:(NSDictionary *)settings completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeSensorSettings:completion:")]
        bool WriteSensorSettings (NSDictionary settings, SBKBeaconCompletionBlock completion);

        // -(BOOL)resetToFactorySettingsWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("resetToFactorySettingsWithCompletion:")]
        bool ResetToFactorySettingsWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)writeSecureBroadcastInterval:(SBKBeaconSecureBroadcastInterval)interval completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeSecureBroadcastInterval:completion:")]
        bool WriteSecureBroadcastInterval (SBKBeaconSecureBroadcastInterval interval, SBKBeaconCompletionBlock completion);

        // -(BOOL)writeBroadcastKey:(NSString *)key completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeBroadcastKey:completion:")]
        bool WriteBroadcastKey (string key, SBKBeaconCompletionBlock completion);

        // -(BOOL)clearBroadcastKeyWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("clearBroadcastKeyWithCompletion:")]
        bool ClearBroadcastKeyWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)disableiBeaconWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("disableiBeaconWithCompletion:")]
        bool DisableiBeaconWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)enableiBeaconWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("enableiBeaconWithCompletion:")]
        bool EnableiBeaconWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)disableAliBeaconWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("disableAliBeaconWithCompletion:")]
        bool DisableAliBeaconWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)enableAliBeaconWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("enableAliBeaconWithCompletion:")]
        bool EnableAliBeaconWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)disableEnhanceBroadcastWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("disableEnhanceBroadcastWithCompletion:")]
        bool DisableEnhanceBroadcastWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)enableEnhanceBroadcastWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("enableEnhanceBroadcastWithCompletion:")]
        bool EnableEnhanceBroadcastWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)flashLightWithCommand:(UInt8)command repeat:(UInt8)repeatCount completion:(SBKBeaconCompletionBlock)completion;
        [Export ("flashLightWithCommand:repeat:completion:")]
        bool FlashLightWithCommand (byte command, byte repeatCount, SBKBeaconCompletionBlock completion);

        // @property (readonly, nonatomic) SBKBeaconWritePermissionStatus writePermissionStatus;
        [Export ("writePermissionStatus")]
        SBKBeaconWritePermissionStatus WritePermissionStatus  get; 

        // -(BOOL)requireWritePermissionWithPassword:(NSString *)password completion:(SBKBeaconCompletionBlock)completion;
        [Export ("requireWritePermissionWithPassword:completion:")]
        bool RequireWritePermissionWithPassword (string password, SBKBeaconCompletionBlock completion);

        // -(BOOL)updateWritePassword:(NSString *)password completion:(SBKBeaconCompletionBlock)completion;
        [Export ("updateWritePassword:completion:")]
        bool UpdateWritePassword (string password, SBKBeaconCompletionBlock completion);

        // -(BOOL)clearWritePasswordWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("clearWritePasswordWithCompletion:")]
        bool ClearWritePasswordWithCompletion (SBKBeaconCompletionBlock completion);

        // -(SBKBeaconEnergySavingMode)availableEnergySavingMode;
        [Export ("availableEnergySavingMode")]
        //[Verify (MethodToProperty)]
        SBKBeaconEnergySavingMode AvailableEnergySavingMode  get; 

        // -(BOOL)reloadSensorDataWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("reloadSensorDataWithCompletion:")]
        bool ReloadSensorDataWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)isTemperatureSensorAvailable;
        [Export ("isTemperatureSensorAvailable")]
        //[Verify (MethodToProperty)]
        bool IsTemperatureSensorAvailable  get; 

        // -(BOOL)isLightSensorAvailable;
        [Export ("isLightSensorAvailable")]
        //[Verify (MethodToProperty)]
        bool IsLightSensorAvailable  get; 

        // -(BOOL)isAccelerometerAvailable;
        [Export ("isAccelerometerAvailable")]
        //[Verify (MethodToProperty)]
        bool IsAccelerometerAvailable  get; 

        // -(BOOL)isBeacon;
        [Export ("isBeacon")]
        //[Verify (MethodToProperty)]
        bool IsBeacon  get; 

        // -(BOOL)isSensor;
        [Export ("isSensor")]
        //[Verify (MethodToProperty)]
        bool IsSensor  get; 

        // @property (readonly, copy, nonatomic) NSNumber * temperature;
        [Export ("temperature", ArgumentSemantic.Copy)]
        NSNumber Temperature  get; 

        // @property (readonly, copy, nonatomic) NSNumber * light;
        [Export ("light", ArgumentSemantic.Copy)]
        NSNumber Light  get; 

        // @property (readonly, nonatomic) NSNumber * broadcastTransmitPower;
        [Export ("broadcastTransmitPower")]
        NSNumber BroadcastTransmitPower  get; 

        // @property (readonly, nonatomic) NSNumber * broadcastInterval;
        [Export ("broadcastInterval")]
        NSNumber BroadcastInterval  get; 

        // @property (readonly, nonatomic) NSNumber * inEnergySaving;
        [Export ("inEnergySaving")]
        NSNumber InEnergySaving  get; 

        // @property (readonly, nonatomic) NSNumber * aliBeacon;
        [Export ("aliBeacon")]
        NSNumber AliBeacon  get; 

        // @property (readonly, nonatomic) NSNumber * enhanceBroadcast;
        [Export ("enhanceBroadcast")]
        NSNumber EnhanceBroadcast  get; 

        // @property (readonly, nonatomic) NSNumber * eddystoneEnabled;
        [Export ("eddystoneEnabled")]
        NSNumber EddystoneEnabled  get; 

        // @property (readonly, copy, nonatomic) NSNumber * accelerometerCount;
        [Export ("accelerometerCount", ArgumentSemantic.Copy)]
        NSNumber AccelerometerCount  get; 

        // @property (readonly, getter = isMoving, copy, nonatomic) NSNumber * moving;
        [Export ("moving", ArgumentSemantic.Copy)]
        NSNumber Moving  [Bind ("isMoving")] get; 

        // @property (readonly, nonatomic) NSNumber * shakeToLightOn;
        [Export ("shakeToLightOn")]
        NSNumber ShakeToLightOn  get; 

        // -(BOOL)resetAccelerometerCountWithCompletion:(SBKBeaconCompletionBlock)completion;
        [Export ("resetAccelerometerCountWithCompletion:")]
        bool ResetAccelerometerCountWithCompletion (SBKBeaconCompletionBlock completion);

        // -(BOOL)writeShakeToLightOnState:(BOOL)state completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeShakeToLightOnState:completion:")]
        bool WriteShakeToLightOnState (bool state, SBKBeaconCompletionBlock completion);

        // @property (readonly, nonatomic, strong) CBPeripheral * assignedPeripheral;
        [Export ("assignedPeripheral", ArgumentSemantic.Strong)]
        CBPeripheral AssignedPeripheral  get; 

        // @property (readonly, nonatomic) NSNumber * eddystoneUIDEnabled;
        [Export ("eddystoneUIDEnabled")]
        NSNumber EddystoneUIDEnabled  get; 

        // @property (readonly, nonatomic) NSNumber * eddystoneURLEnabled;
        [Export ("eddystoneURLEnabled")]
        NSNumber EddystoneURLEnabled  get; 

        // @property (readonly, nonatomic) NSNumber * eddystoneTLMEnabled;
        [Export ("eddystoneTLMEnabled")]
        NSNumber EddystoneTLMEnabled  get; 

        // @property (readonly, nonatomic) NSData * eddystoneNID;
        [Export ("eddystoneNID")]
        NSData EddystoneNID  get; 

        // @property (readonly, nonatomic) NSData * eddystoneBID;
        [Export ("eddystoneBID")]
        NSData EddystoneBID  get; 

        // @property (readonly, nonatomic) NSNumber * eddystoneTLMInterval;
        [Export ("eddystoneTLMInterval")]
        NSNumber EddystoneTLMInterval  get; 

        // @property (readonly, nonatomic) NSString * eddystoneUrl;
        [Export ("eddystoneUrl")]
        string EddystoneUrl  get; 

        // @property (readonly, nonatomic) NSNumber * eddystoneBatteryVoltage;
        [Export ("eddystoneBatteryVoltage")]
        NSNumber EddystoneBatteryVoltage  get; 

        // @property (readonly, nonatomic) NSNumber * eddystonePduCount;
        [Export ("eddystonePduCount")]
        NSNumber EddystonePduCount  get; 

        // @property (readonly, nonatomic) NSNumber * eddystoneWorkedTime;
        [Export ("eddystoneWorkedTime")]
        NSNumber EddystoneWorkedTime  get; 

        // -(BOOL)writeEddystoneUrl:(NSString *)url completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeEddystoneUrl:completion:")]
        bool WriteEddystoneUrl (string url, SBKBeaconCompletionBlock completion);

        // -(BOOL)eddystonePackage:(EddystonePackageType)package enable:(BOOL)enable completion:(SBKBeaconCompletionBlock)completion;
        [Export ("eddystonePackage:enable:completion:")]
        bool EddystonePackage (EddystonePackageType package, bool enable, SBKBeaconCompletionBlock completion);

        // -(BOOL)writeEddystoneTLMInterval:(EddystoneTLMInterval)interval completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeEddystoneTLMInterval:completion:")]
        bool WriteEddystoneTLMInterval (EddystoneTLMInterval interval, SBKBeaconCompletionBlock completion);

        // -(BOOL)writeEddystoneNID:(NSString *)nidString completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeEddystoneNID:completion:")]
        bool WriteEddystoneNID (string nidString, SBKBeaconCompletionBlock completion);

        // -(BOOL)writeEddystoneBID:(NSString *)bidString completion:(SBKBeaconCompletionBlock)completion;
        [Export ("writeEddystoneBID:completion:")]
        bool WriteEddystoneBID (string bidString, SBKBeaconCompletionBlock completion);
    

    // @protocol SBKBeaconDelegate <NSObject>
    [Protocol, Model]
    [BaseType (typeof(NSObject))]
    interface SBKBeaconDelegate
    
        // @optional -(void)sensoroBeaconDidConnect:(SBKBeacon *)beacon;
        [Export ("sensoroBeaconDidConnect:")]
        void SensoroBeaconDidConnect (SBKBeacon beacon);

        // @optional -(void)sensoroBeaconRequirePassword:(SBKBeacon *)beacon;
        [Export ("sensoroBeaconRequirePassword:")]
        void SensoroBeaconRequirePassword (SBKBeacon beacon);

        // @optional -(void)sensoroBeaconDidDisconnect:(SBKBeacon *)beacon error:(NSError *)error;
        [Export ("sensoroBeaconDidDisconnect:error:")]
        void SensoroBeaconDidDisconnect (SBKBeacon beacon, NSError error);

        // @optional -(void)sensoroBeacon:(SBKBeacon *)beacon didUpdateSensorSetting:(NSDictionary *)settings;
        [Export ("sensoroBeacon:didUpdateSensorSetting:")]
        void SensoroBeaconDidUpdateSensorSetting (SBKBeacon beacon, NSDictionary settings);

        // @optional -(void)sensoroBeacon:(SBKBeacon *)beacon didUpdateRSSI:(NSInteger)rssi;
        [Export ("sensoroBeacon:didUpdateRSSI:")]
        void SensoroBeaconDidUpdateRSSI (SBKBeacon beacon, nint rssi);

        // @optional -(void)sensoroBeacon:(SBKBeacon *)beacon didUpdateTemperatureData:(NSNumber *)temperature;
        [Export ("sensoroBeacon:didUpdateTemperatureData:")]
        void SensoroBeaconDidUpdateTemperatureData (SBKBeacon beacon, NSNumber temperature);

        // @optional -(void)sensoroBeacon:(SBKBeacon *)beacon didUpdateLightData:(NSNumber *)light;
        [Export ("sensoroBeacon:didUpdateLightData:")]
        void SensoroBeaconDidUpdateLightData (SBKBeacon beacon, NSNumber light);

        // @optional -(void)sensoroBeacon:(SBKBeacon *)beacon didUpdateAccelerometerCount:(NSNumber *)accelerometerCount;
        [Export ("sensoroBeacon:didUpdateAccelerometerCount:")]
        void SensoroBeaconDidUpdateAccelerometerCount (SBKBeacon beacon, NSNumber accelerometerCount);

        // @optional -(void)sensoroBeacon:(SBKBeacon *)beacon didUpdateMovingState:(NSNumber *)isMoving;
        [Export ("sensoroBeacon:didUpdateMovingState:")]
        void SensoroBeaconDidUpdateMovingState (SBKBeacon beacon, NSNumber isMoving);
    

    // typedef void (^SBKBeaconWatcher)(SBKBeacon *, SBKBeacon_Action);
    delegate void SBKBeaconWatcher (SBKBeacon arg0, SBKBeacon_Action arg1);

    // @interface SBKBeaconManager : NSObject
    [BaseType (typeof(NSObject))]
    interface SBKBeaconManager
    
        // +(SBKBeaconManager *)sharedInstance;
        [Static]
        [Export ("sharedInstance")]
        //[Verify (MethodToProperty)]
        SBKBeaconManager SharedInstance  get; 

        [Wrap ("WeakDelegate")]
        [NullAllowed]
        SBKBeaconManagerDelegate Delegate  get; set; 

        // @property (nonatomic, weak) id<SBKBeaconManagerDelegate> _Nullable delegate;
        [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
        NSObject WeakDelegate  get; set; 

        // -(void)requestAlwaysAuthorization;
        [Export ("requestAlwaysAuthorization")]
        void RequestAlwaysAuthorization ();

        // -(void)requestWhenInUseAuthorization;
        [Export ("requestWhenInUseAuthorization")]
        void RequestWhenInUseAuthorization ();

        // -(void)startRangingBeaconsWithID:(SBKBeaconID *)beaconID wakeUpApplication:(BOOL)wakeUpApplication;
        [Export ("startRangingBeaconsWithID:wakeUpApplication:")]
        void StartRangingBeaconsWithID (SBKBeaconID beaconID, bool wakeUpApplication);

        // -(void)stopRangingBeaconsWithID:(SBKBeaconID *)beaconID;
        [Export ("stopRangingBeaconsWithID:")]
        void StopRangingBeaconsWithID (SBKBeaconID beaconID);

        // -(void)stopRangingAllBeacons;
        [Export ("stopRangingAllBeacons")]
        void StopRangingAllBeacons ();

        // -(BOOL)addBroadcastKey:(NSString *)secretInfo;
        [Export ("addBroadcastKey:")]
        bool AddBroadcastKey (string secretInfo);

        // -(void)registerBeaconAppearWatcher:(NSString *)identifier type:(u_int8_t)type watcher:(SBKBeaconWatcher)watcher;
        [Export ("registerBeaconAppearWatcher:type:watcher:")]
        void RegisterBeaconAppearWatcher (string identifier, byte type, SBKBeaconWatcher watcher);

        // -(NSSet *)rangedBeaconIDs;
        [Export ("rangedBeaconIDs")]
        //[Verify (MethodToProperty)]
        NSSet RangedBeaconIDs  get; 

        // -(SBKBeacon *)beaconWithID:(SBKBeaconID *)beaconID;
        [Export ("beaconWithID:")]
        SBKBeacon BeaconWithID (SBKBeaconID beaconID);

        // -(SBKBeacon *)beaconWithCLBeacon:(CLBeacon *)beacon;
        [Export ("beaconWithCLBeacon:")]
        SBKBeacon BeaconWithCLBeacon (CLBeacon beacon);

        // -(NSArray *)beaconsInRange;
        [Export ("beaconsInRange")]
        //[Verify (MethodToProperty), Verify (StronglyTypedNSArray)]
        NSObject[] BeaconsInRange  get; 

        // -(NSArray *)allBeacons;
        [Export ("allBeacons")]
        //[Verify (MethodToProperty), Verify (StronglyTypedNSArray)]
        NSObject[] AllBeacons  get; 

        // -(void)disableBLEPowerAlert;
        [Export ("disableBLEPowerAlert")]
        void DisableBLEPowerAlert ();

        // @property (readwrite, nonatomic) NSTimeInterval outOfRangeDelay;
        [Export ("outOfRangeDelay")]
        double OutOfRangeDelay  get; set; 

        // @property (readonly, nonatomic) NSString * version;
        [Export ("version")]
        string Version  get; 

        // @property (readwrite, nonatomic) BOOL duplicateKeyBLE;
        [Export ("duplicateKeyBLE")]
        bool DuplicateKeyBLE  get; set; 

        // -(void)setDebugModeActive:(BOOL)active;
        [Export ("setDebugModeActive:")]
        void SetDebugModeActive (bool active);
    

    // @protocol SBKBeaconManagerDelegate <NSObject>
    [Protocol, Model]
    [BaseType (typeof(NSObject))]
    interface SBKBeaconManagerDelegate
    
        // @optional -(void)beaconManager:(SBKBeaconManager *)beaconManager didRangeNewBeacon:(SBKBeacon *)beacon;
        [Export ("beaconManager:didRangeNewBeacon:")]
        void DidRangeNewBeacon (SBKBeaconManager beaconManager, SBKBeacon beacon);

        // @optional -(void)beaconManager:(SBKBeaconManager *)beaconManager beaconDidGone:(SBKBeacon *)beacon;
        [Export ("beaconManager:beaconDidGone:")]
        void BeaconDidGone (SBKBeaconManager beaconManager, SBKBeacon beacon);

        // @optional -(void)beaconManager:(SBKBeaconManager *)beaconManager scanDidFinishWithBeacons:(NSArray *)beacons;
        [Export ("beaconManager:scanDidFinishWithBeacons:")]
        //[Verify (StronglyTypedNSArray)]
        void ScanDidFinishWithBeacons (SBKBeaconManager beaconManager, NSObject[] beacons);

        // @optional -(void)beaconManager:(SBKBeaconManager *)beaconManager didRangeBeacons:(NSArray *)beacons inRegion:(SBKBeaconID *)region;
        [Export ("beaconManager:didRangeBeacons:inRegion:")]
        //[Verify (StronglyTypedNSArray)]
        void DidRangeBeacons (SBKBeaconManager beaconManager, NSObject[] beacons, SBKBeaconID region);

        // @optional -(void)beaconManager:(SBKBeaconManager *)beaconManager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
        [Export ("beaconManager:didChangeAuthorizationStatus:")]
        void DidChangeAuthorizationStatus (SBKBeaconManager beaconManager, CLAuthorizationStatus status);

        // @optional -(void)beaconManager:(SBKBeaconManager *)beaconManager didDetermineState:(SBKRegionState)state forRegion:(SBKBeaconID *)region;
        [Export ("beaconManager:didDetermineState:forRegion:")]
        void DidDetermineState (SBKBeaconManager beaconManager, SBKRegionState state, SBKBeaconID region);
    

    // @interface Cloud (SBKBeaconManager)
    [Category]
    [BaseType (typeof(SBKBeaconManager))]
    interface SBKBeaconManager_Cloud
    
        // -(void)setCloudServiceEnable:(BOOL)set;
        [Export ("setCloudServiceEnable:")]
        void SetCloudServiceEnable (bool set);
    

    // @interface SBKUnitConvertHelper : NSObject
    [BaseType (typeof(NSObject))]
    interface SBKUnitConvertHelper
    
        // +(float)rangeRadiusOfBeacon:(SBKBeacon *)beacon;
        [Static]
        [Export ("rangeRadiusOfBeacon:")]
        float RangeRadiusOfBeacon (SBKBeacon beacon);

        // +(short)transmitPowerToRawValue:(SBKBeacon *)beacon;
        [Static]
        [Export ("transmitPowerToRawValue:")]
        short TransmitPowerToRawValue (SBKBeacon beacon);

        // +(float)frequencyToRawValue:(SBKBeacon *)beacon;
        [Static]
        [Export ("frequencyToRawValue:")]
        float FrequencyToRawValue (SBKBeacon beacon);

        // +(NSString *)transmitPowerToString:(SBKBeacon *)beacon;
        [Static]
        [Export ("transmitPowerToString:")]
        string TransmitPowerToString (SBKBeacon beacon);

        // +(NSString *)frequencyToString:(SBKBeacon *)beacon;
        [Static]
        [Export ("frequencyToString:")]
        string FrequencyToString (SBKBeacon beacon);

        // +(BOOL)isMicroTX:(SBKBeacon *)beacon;
        [Static]
        [Export ("isMicroTX:")]
        bool IsMicroTX (SBKBeacon beacon);

        // +(NSData *)urlToEddystoneEncodeURL:(NSString *)url;
        [Static]
        [Export ("urlToEddystoneEncodeURL:")]
        NSData UrlToEddystoneEncodeURL (string url);
    

【问题讨论】:

原来我可能需要使用 btouch-native 而不是只使用 btouch,因为 monotouch 现在已经过时了。但是我到底该如何配置 Xamarin Studio 以使用该工具的本机版本? 我用的是btouch-native的命令行版本,还是说NSUuid不是支持的类型...啊! 【参考方案1】:

尝试将其注释掉以使错误消失:

// extern NSUuid * SBKSensoroDefaultProximityUUID;
[Field ("SBKSensoroDefaultProximityUUID", "__Internal")]
NSUuid SBKSensoroDefaultProximityUUID  get; 

然后file a bug 解决问题。

【讨论】:

我也绑定了这个库,我将 NSUuid 更改为 IntPtr,然后添加了一个帮助器将其转换为 NSUuid...我添加了一个答案,显示了我为实现这一目标所做的工作允许您获取 guid 常量。【参考方案2】:

我已绑定该库,您可以将 NSUuid 转换为 IntPtr,因为 NSUuid 不支持作为 Field 属性。

1st) 查看标题定义:

extern NSUUID * SBKSensoroDefaultProximityUUID;

由于它是一个指向 NSUuid 的指针,因此您可以使用 IntPtr 来代替,并且支持这些作为字段属性。

2nd) 在您的ApiDefinition.cs 中将NSUuid 更改为IntPtr

//// extern NSUuid * SBKSensoroDefaultProximityUUID;
[Field("SBKSensoroDefaultProximityUUID", "__Internal")]
IntPtr SBKSensoroDefaultProximityUUID  get; 

3nd) 创建一个.cs 文件(即Extra.cs)来保存将IntPtr 转换为NSUuid 的辅助属性:

using Foundation;
using ObjCRuntime;

namespace Sushi.Sensoro.BeaconKit


    public class ConstantsEx
    
        static NSUuid _SBKSensoroDefaultProximityUUID;
        static public NSUuid SBKSensoroDefaultProximityUUID
        
            get
            
                if (_SBKSensoroDefaultProximityUUID == null)
                
                    var libUUID = Runtime.GetNSObject(Constants.SBKSensoroDefaultProximityUUID) as NSUuid;
                    _SBKSensoroDefaultProximityUUID = new NSUuid(libUUID.GetBytes());
                
                return _SBKSensoroDefaultProximityUUID;
            
        
    

用法:

var _SBKSensoroDefaultProximityUUID = Sushi.Sensoro.BeaconKit.ConstantsEx.SBKSensoroDefaultProximityUUID;
Console.WriteLine(_SBKSensoroDefaultProximityUUID);

注意:此常量应为“23A01AF0-232A-4518-9C0E-323FB773F5EF”(至少在 Sensoro SDK 的 4.1.3 版本中)

【讨论】:

以上是关于Xamarin Studio btouch 不支持的字段类型:NSUuid的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 Xamarin Visual Studio 2015 构建 Android App Bundle?

iCloud:应用程序在 Xamarin Studio 中验证,但不在 XCode 中

Xamarin 与 Visual Studio:Resource.Id 不包含“...”的定义

Xamarin Visual Studio不识别JDK路径

xamarin for Visual Studio 不显示模拟器列表

Visual Studio 2015 / Xamarin,调试不工作:执行 MTouch 时出错