第三方库中的MonoTouch绑定通知

Jim*_*len 3 c# binding objective-c xamarin.ios ios

我正在为IDTech CC swipers创建绑定.我一直在反对这个问题.我坚持如何订阅第三方库引发的事件.具体来说,我需要知道卡片刷卡何时发生.

//Notification identifiers used with NSNotificationCenter
//physical attachment related
extern NSString * const uniMagAttachmentNotification;
extern NSString * const uniMagDetachmentNotification;
//connection related
extern NSString * const uniMagInsufficientPowerNotification;
extern NSString * const uniMagPoweringNotification;
extern NSString * const uniMagTimeoutNotification;
extern NSString * const uniMagDidConnectNotification;
extern NSString * const uniMagDidDisconnectNotification;
//swipe related
extern NSString * const uniMagSwipeNotification;
extern NSString * const uniMagTimeoutSwipeNotification;
extern NSString * const uniMagDataProcessingNotification;
extern NSString * const uniMagInvalidSwipeNotification;
extern NSString * const uniMagDidReceiveDataNotification;
//command related
extern NSString * const uniMagCmdSendingNotification;
extern NSString * const uniMagCommandTimeoutNotification;
extern NSString * const uniMagDidReceiveCmdNotification;
//misc
extern NSString * const uniMagSystemMessageNotification;
Run Code Online (Sandbox Code Playgroud)

文档说这应该工作:

    [Notification]
    [Field ("uniMagAttachmentNotification")]
    NSString uniMagAttachmentNotification { get; }
Run Code Online (Sandbox Code Playgroud)

它不编译.

obj/Debug/ios/magTechBinding/uniMag.g.cs(637,95): error CS0117: `MonoTouch.Constants' does not contain a definition for `magTechBindingLibrary'
obj/Debug/ios/magTechBinding/uniMag.g.cs(637,77): error CS1502: The best overloaded method match for `MonoTouch.ObjCRuntime.Dlfcn.dlopen(string, int)' has some invalid arguments
obj/Debug/ios/magTechBinding/uniMag.g.cs(637,77): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
Run Code Online (Sandbox Code Playgroud)

任何想法或帮助将不胜感激!

pou*_*pou 5

尝试:

[Field ("uniMagAttachmentNotification", "__Internal")]
Run Code Online (Sandbox Code Playgroud)

第二个参数告诉在哪个库中查找该字段.没有一个发电机假设你将有一个恒定的准备.

现在,因为您将链接第三方静态(.a)库,它将成为最终可执行文件的一部分.这就是为什么__Internal必须用作库名称(它意味着查看主要可执行文件).