Issue binding third party library

EverettEverett USMember ✭✭
edited October 2015 in Xamarin.iOS

Quick apology, I posted this in the objective sharpie forums, but I get the impression there isn't much eye traffic there, so thought I'd repost here.

I'm trying to bind a third party library, and I have managed to resolve most issues, but when referencing the library in a project and building, I receive the error below

error : Native linking failed, undefined symbol: "kProperty". This symbol was referenced by the managed member "name.of.binded.library.className.kProperty". Please verify that all the necessary frameworks have been referenced and native libraries linked.

namespace name.of.binded.library
    [BaseType (typeof(NSObject))]
    public interface className
        [Field ("kProperty", "__Internal")]
        NSString kProperty{ get; }

Could someone possibly point me in the right direction on what is going on here? From within the application I seem to be able to access the said class/property just fine.

Thank you.

Best Answer


  • adamkempadamkemp USInsider, Developer Group Leader mod

    Do you actually have a field named kProperty? What does that look like in the headers?

  • EverettEverett USMember ✭✭

    Haha sorry no I don't, I generalized the field/namespace for the sake of the post.
    the real name is kROXStateNotification
    in the header file its listed as

    @interface ROXNotifications : NSObject
        //bunch of other fields (all extern NSString * const)
        extern NSString * const kROXStateNotification;


  • EverettEverett USMember ✭✭
    edited October 2015

    Adam, thank you for once again coming to the rescue! :) I ended up deleting the class in the APIDefinitions and that seemed to resolve it, although I haven't had a chance to thoroughly test it out. The library and the application using the library both build and run without any warnings/errors, so seems good so far. Still wiring up a test harness though.

    One thing: Some functions in other classes return an array of NSObject which is supposed to be the ROXNotifications class, how would I go about casting the NSObject to the ROXNotifications class? Is deleting the interface the wrong way to go about this?
    Thanks again

  • adamkempadamkemp USInsider, Developer Group Leader mod

    If you have a binding that returns an NSObject[], but you happen to know that at runtime all of those objects are actually Foo objects then you can change the binding to use Foo[] instead. It will do the right thing. This makes the C# bindings in many cases more type-safe than the Objective-C APIs.

  • EverettEverett USMember ✭✭

    Thank you Adam, that is what I did, however, the return type is the return type ROXNotifications that you suggested I delete (which seemed to work, except now I'm not able to do much with the returned objects) so I believe I need to go back a step and see about properly implementing that class. I got a bit sidetracked on another project and put this one on temp hold, but I will mark your comment as an answer, and in the mean time I will go back over the ios binding docs

Sign In or Register to comment.