Xamarin iOS绑定,库中找不到符号
我需要Xamarin.iOS项目的草图/绘画控件,虽然我似乎无法找到与C#兼容的一个,但我确实发现了一个可用Objective C编写的好组件https://github.com/acerbetti/ACEDrawingViewXamarin iOS绑定,库中找不到符号
我已经完成了Xamarin绑定,所以我希望这个过程相当简单,但不幸的是我一路上遇到了一些障碍。
我开始创建我的静态库和使用Ant构建脚本做出FAT二进制覆盖设备和模拟器:
我的ant脚本
AceDrawingViewSDK.a: libAceDrawingView-i386.a libAceDrawingView-armv7.a libAceDrawingView-armv7s.a libAceDrawingView-arm64.a xcrun -sdk iphoneos lipo -create -output [email protected] $^
接下来的片断,我跑
sharpie bind --sdk=iphoneos10.1 *.h
上的头文件得到我的ApiDefinitions和Structs和Enum文件。
我检查并删除了验证属性。 (他们都看起来很好。)但这是我的其他一些问题开始的地方。
The type ACEDrawingLabelViewTransform' already contains a definition forTransform' (CS0102) (AceDrawingViewBinding).
为了仅仅试图继续前进并找到一些工作,我刚刚评论了这个参考。
然后我得到了许多问题,与此类似:
The type or namespace name `IACEDrawingTool' could not be found. Are you missing an assembly reference? (CS0246) (AceDrawingViewBinding)
我想它涉及到这一点:
// @interface ACEDrawingPenTool : UIBezierPath
[BaseType(typeof(UIBezierPath))]
interface ACEDrawingPenTool : IACEDrawingTool
这:
// @protocol ACEDrawingTool
[Protocol, Model]
[BaseType(typeof(NSObject))]
interface ACEDrawingTool
我试图解决这个问题我使接口名称一致(我尝试了IACEDrawingTool和ACEDrawingTool。)这样做通过了这个错误或者,让我编译
我的一个枚举出来作为
[Native]
public enum ACEDrawingMode : nuint
{
Scale,
OriginalSize
}
我找不到怎么处理[本地]在这种情况下,(所以再次,测试的缘故,我删除它。 )我尝试使用从枚举中删除nuint并使用uint。这两种方法似乎都能解决这个错误。
因此,修复这些错误后,我能够从绑定项目生成.dll文件并将其添加到我的主项目中。
现在,我收到2个问题。
如果我构建并部署到模拟器,我可以运行我的应用程序,直到我试图从绑定中创建ACEDrawingView的新实例。我得到:
Could not create an native instance of the type 'ACEDrawingView': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.
如果我尝试建立并部署到我的电话,我得到的构建阶段,防止其从设备上推出的所有不同的错误:
MTOUCH: error MT5211: Native linking failed, undefined Objective-C class: ACEDrawingArrowTool. The symbol 'OBJC_CLASS$ACEDrawingArrowTool' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH: error MT5211: Native linking failed, undefined Objective-C class: ACEDrawingDraggableTextTool. The symbol '_OBJC_CLASS$ACEDrawingDraggableTextTool' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH: error MT5211: Native linking failed, undefined Objective-C class: ACEDrawingEllipseTool. The symbol '_OBJC_CLASS$_ACEDrawingEllipseTool' could not be found in any of the libraries or frameworks linked with your application.
...和等等。
我试过回去,重读和重做步骤,并试图从我以前的成功绑定中重用一些脚本和设置,但没有运气。
有没有人有什么可以解决这些问题的建议?
无法找到类型或命名空间名称`IACEDrawingTool'。
添加一个新的接口,这样interface IACEDrawingTool{ }
公共枚举ACEDrawingMode:nuint
更改nuint
到ulong