Monotouch Binding project build errors
I am getting the following errors when trying to build a bindings project. The information is a bit cryptic and I am not sure what is broken/wrong.
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)
I notice sometimes that when I close and reopen the project, then rebuild, the error messages don't appear immediately, but shortly after, they come right back.
Any ideas? Let me know if you need the source for my bindings project.
This is because you are missing a parameter on the [FieldAttribute] documented at the end that says
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; }
}
So your binding right now looks like this
[BaseType (typeof (NIRecyclableView))]
public partial interface NIPageView : NIPagingScrollViewPage
{
[Field ("NIPagingScrollViewUnknownNumberOfPages")]
int NIPagingScrollViewUnknownNumberOfPages { get; }
[Field ("NIPagingScrollViewDefaultPageMargin")]
float NIPagingScrollViewDefaultPageMargin { get; }
}
And it must be like this
[BaseType (typeof (NIRecyclableView))]
public partial interface NIPageView : NIPagingScrollViewPage
{
[Field ("NIPagingScrollViewUnknownNumberOfPages", "__Internal")]
int NIPagingScrollViewUnknownNumberOfPages { get; }
[Field ("NIPagingScrollViewDefaultPageMargin", "__Internal")]
float NIPagingScrollViewDefaultPageMargin { get; }
}
This is because all static libraries at the end will be merged with the main executable.
Hope this helps.
Alex
链接地址: http://www.djcxy.com/p/62942.html上一篇: 使用C#客户端和Java服务器端调用webservice时的InvalidOperationException