【发布时间】:2013-02-25 15:43:57
【问题描述】:
我有以下Obj-C .h,正确的绑定方式是什么?
@interface iSmart : NSObject<EAAccessoryDelegate>{
id<iSmartDelegate> delegate;
}
@property(nonatomic, assign) id<iSmartDelegate> delegate;
-(id)init;
@end
__________________________________________________________________________________________
@class iSmart;
@protocol iSmartDelegate <NSObject>
-(void) iSmartDidConnect;
-(void) iSmartDidDisconnect;
-(void) cardStatusChanged:(unsigned char)status;
@end
__________________________________________________________________________________________
此刻我有这个协议和接口:
[BaseType (typeof(NSObject))]
[Model]
interface iSmartDelegate
{
[Export("iSmartDidConnect")]
void iSmartDidConnect();
[Export("iSmartDidDisconnect")]
void iSmartDidDisconnect();
[Export("cardStatusChanged:")]
void CardStatusChanged(Byte status);
}
[BaseType (typeof (EAAccessoryDelegate),
Delegates=new string [] { "WeakDelegate" },
Events=new Type [] { typeof (iSmartDelegate)})]
interface iSmart
{
//@property(nonatomic, assign) id<iSmartDelegate> delegate;
[Export("delegate"), NullAllowed]
NSObject WeakDelegate { get; set; }
[Wrap("WeakDelegate")]
iSmartDelegate Delegate { get; set; }
//-(id)init;
[Export("init")]
NSObject init();
}
当我尝试在 Xamarin Studio 中构建项目时遇到此错误 错误 BI0000:意外错误 - 请在 http://bugzilla.xamarin.com (BI0000) 提交错误报告
谢谢
【问题讨论】:
-
绑定 iSmartDelegate 和 EEAccessoryDelegate 协议是两个不同的独立问题
-
EAAccessoryDelegate 是命名空间 MonoTouch.ExternalAccessory 中的一个类
-
unsigned char 到 char 可能是错误的。将本机无符号字符编组为 .NET 字节,因为 .NET 字符长 2 个字节(以支持 unicode)
-
BI0000是生成器问题。您可以运行生成器并将详细程度设置为 2 或 3 并报告日志吗?
标签: c# ios objective-c xamarin.ios