簡體   English   中英

第三方庫中的MonoTouch綁定通知

[英]MonoTouch binding notifications in 3rd party library

我正在為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;

文檔說這應該工作:

    [Notification]
    [Field ("uniMagAttachmentNotification")]
    NSString uniMagAttachmentNotification { get; }

它不編譯。

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'

任何想法或幫助將不勝感激!

嘗試:

[Field ("uniMagAttachmentNotification", "__Internal")]

第二個參數告訴在哪個庫中查找該字段。 沒有一個發電機假設你將有一個恆定的准備。

現在,因為您將鏈接第三方靜態 (.a)庫,它將成為最終可執行文件的一部分。 這就是__Internal必須用作庫名的原因(它意味着查看主可執行文件內部)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM