2
votes

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 convertobject' 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.

1
Does it go away if you clean the solution before rebuilding it? There is a quite old bug in MD/XS that prevents building bindings projects if there are already intermediate files on the disk.Krumelur
Cleaning still doesn't resolve the issue. I checked in my solution on my repo. Check this commit. github.com/theonlylawislove/MonoTouch.Nimbus/tree/…Paul Knopf
This commit may help identify the issue. Commenting out these to properties caused the build to pass. github.com/theonlylawislove/MonoTouch.Nimbus/commit/…Paul Knopf

1 Answers

4
votes

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