我试图创建我映射的类的对象。
[BaseType(typeof(NSObject))]
interface LibClass
{
// @property (readonly) NSString * key;
[Export("key")]
string Key { get; }
// @property (readonly) NSArray * blockNames;
[Export("blockNames")]
//[Verify (StronglyTypedNSArray)] //TODO: Verify
NSObject[] BlockNames { get; }
}
但代码new LibClass();
抛出异常:NSInternalInconsistencyException原因:-init不是类LibClass的有效初始值设定项。
这是生成的构造函数的代码
[CompilerGenerated]
[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("init")]
public LibClass () : base (NSObjectFlag.Empty)
{
IsDirectBinding = GetType ().Assembly == global::ApiDefinition.Messaging.this_assembly;
if (IsDirectBinding) {
InitializeHandle (global::ApiDefinition.Messaging.IntPtr_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("init")), "init");
} else {
InitializeHandle (global::ApiDefinition.Messaging.IntPtr_objc_msgSendSuper (this.SuperHandle, global::ObjCRuntime.Selector.GetHandle ("init")), "init");
}
}