首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >第三方库中的MonoTouch绑定通知

第三方库中的MonoTouch绑定通知
EN

Stack Overflow用户
提问于 2013-01-23 04:04:05
回答 1查看 447关注 0票数 3

我正在为IDTech CC swipers创建绑定。我已经用头撞了它好一阵子了。我被困在如何订阅由第三方库引发的事件。具体地说,我需要知道何时发生了刷卡。

代码语言:javascript
复制
//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;

文档说这应该是可行的:

代码语言:javascript
复制
    [Notification]
    [Field ("uniMagAttachmentNotification")]
    NSString uniMagAttachmentNotification { get; }

它不能编译。

代码语言:javascript
复制
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'

如有任何想法或帮助,我们将不胜感激!

EN

回答 1

Stack Overflow用户

发布于 2013-01-23 04:50:02

尝试:

代码语言:javascript
复制
[Field ("uniMagAttachmentNotification", "__Internal")]

第二个参数告诉在哪个库中查找该字段。如果没有一个,生成器会假定你会有一个常量。

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

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14467054

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档