我正在为小马调试器编写绑定,这应该很简单吧?
Pony 通过类成员“defaultInstance”访问
@interface PDDebugger : NSObject
+ (PDDebugger *)defaultInstance;
我已经这样实现了:
[assembly: LinkWith ("libPonyDebugger.a", LinkTarget.Simulator, ForceLoad = true)]
namespace PonyDebugger
{
[BaseType (typeof (NSObject))]
interface PDDebugger
{
[Static] [Export ("defaultInstance")]
PDDebugger DefaultInstance { get; }
[Export ("enableViewHierarchyDebugging")]
PDDebugger EnableViewHierarchyDebugging();
}
}
我可以很好地编译绑定 - 但是当我调用“PDDebugger.DefaultInstance”时,我只会返回 null。我错过了什么?
我什至如何确定消息正在传递给底层的 ObjC 对象?
谢谢!
[编辑] 我已将绑定更新为: using System; 使用 MonoTouch.Foundation;使用 MonoTouch.ObjCRuntime;
** libPonyDebugger.linkwith.cs **
[assembly: LinkWith ("libPonyDebugger.a", LinkTarget.Simulator, ForceLoad = true,
Frameworks = "Security CFNetwork Foundation CoreGraphics UIKit CoreData", LinkerFlags = "-ObjC -licucore")]
namespace PonyDebugger
{
[BaseType (typeof (NSObject), Name="PDDebugger")]//, DisableDefaultCtor]
interface PDDebugger
{
//+ (PDDebugger *)defaultInstance;
[Static, Export ("defaultInstance")]
PDDebugger DefaultInstance();
[Export ("enableViewHierarchyDebugging")]
PDDebugger EnableViewHierarchyDebugging();
}
}
** libSocketRocket.linkwith.cs **
using System;
using MonoTouch.ObjCRuntime;
[assembly: LinkWith ("libSocketRocket.a", LinkTarget.ArmV7 | LinkTarget.Simulator,
Frameworks = "Security CFNetwork Foundation CoreGraphics UIKit CoreData", ForceLoad = true, LinkerFlags = "-ObjC -licucore")]
这一切都 btouches/编译为本机并运行 - 但 PDDebugger.DefaultInstance() 仍然返回 null。