尝试构建绑定(bind)项目时出现以下错误。该信息有点神秘,我不确定哪里出了问题/错误。
Error CS0117:
MonoTouch.Constants' does not contain a definition for
NimbusLibrary' (CS0117) (MonoTouch.Nimbus)Error CS1502: The best overloaded method match for `MonoTouch.ObjCRuntime.Dlfcn.dlopen(string, int)' has some invalid arguments (CS1502) (MonoTouch.Nimbus)
Error CS1503: Argument
#1' cannot convert
object' expression to type `string' (CS1503) (MonoTouch.Nimbus)
我有时注意到,当我关闭并重新打开项目,然后重建时,错误消息不会立即出现,但不久之后,它们会立即出现。
有什么想法吗?如果您需要我的绑定(bind)项目的源代码,请告诉我。
最佳答案
这是因为您缺少 [FieldAttribute] 上的参数记录在最后,上面写着
If you are linking statically, there is no library to bind to, so you need to use the __Internal name:
[Static]
interface LonelyClass {
[Field ("MyFieldFromALibrary", "__Internal")]
NSString MyFieldFromALibrary { get; }
}
所以你现在的绑定(bind)看起来像这样
[BaseType (typeof (NIRecyclableView))]
public partial interface NIPageView : NIPagingScrollViewPage
{
[Field ("NIPagingScrollViewUnknownNumberOfPages")]
int NIPagingScrollViewUnknownNumberOfPages { get; }
[Field ("NIPagingScrollViewDefaultPageMargin")]
float NIPagingScrollViewDefaultPageMargin { get; }
}
而且一定是这样的
[BaseType (typeof (NIRecyclableView))]
public partial interface NIPageView : NIPagingScrollViewPage
{
[Field ("NIPagingScrollViewUnknownNumberOfPages", "__Internal")]
int NIPagingScrollViewUnknownNumberOfPages { get; }
[Field ("NIPagingScrollViewDefaultPageMargin", "__Internal")]
float NIPagingScrollViewDefaultPageMargin { get; }
}
这是因为最后的所有静态库都将与主可执行文件合并。
希望这有帮助。
亚历克斯
关于c# - Monotouch Binding 项目构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16952194/