Could not register the selector because the selector is already registered on a different member.

JayminJaymin ✭✭USMember ✭✭
edited May 3 in Xamarin.iOS

Currently, I am trying to bind the Qualtrics library for the Xamarin.iOS project and I did it but when I run the project then application crashed and it is saying that

Error : "Could not register the selector 'userContentController:didReceiveScriptMessage:' of the member 'QualtricsIos.QualtricsSurveyViewController.UserContentController' because the selector is already registered on the member 'DidReceiveScriptMessage'.

Could not register the selector 'initWithCoder:' of the member 'QualtricsIos.QualtricsSurveyViewController..ctor' because the selector is already registered on the member 'ConstructorCoder'.

I have tried the solution which is similar to it but no luck till now. I have checked the ApiDefinitions and StructsAndEnums as well I did not find the root cause. Can anyone tell me what is wrong?

I have attached both file which is generated using sharpie. Please have a look and let me know what is the issue.

If you want to look at the source code you have also check on GitHub. Here is a link of my repo : QualtricsXam

Thanks!

Best Answer

  • JayminJaymin ✭✭ US ✭✭
    Accepted Answer

    fixed that issue by removing the initWithCoder method QualtricsSurveyViewController and remove the inheritance. this option fixed the selector issue but it throws the object reference not set to an instance of an object exception when running the application.

    I look into the header file and found the SWIFT_CLASS name in the header like

    SWIFT_CLASS("_TtC9Qualtrics29QualtricsSurveyViewController")

    So, The same thing I applied to the ApiDefinitions file

    [BaseType(typeof(UIViewController), Name = "_TtC9Qualtrics29QualtricsSurveyViewController")]

    And bingo!! it is working!!!

    This solution has fixed my all the issue and binding library is successfully working.

Answers

  • JayminJaymin ✭✭ USMember ✭✭
    Accepted Answer

    fixed that issue by removing the initWithCoder method QualtricsSurveyViewController and remove the inheritance. this option fixed the selector issue but it throws the object reference not set to an instance of an object exception when running the application.

    I look into the header file and found the SWIFT_CLASS name in the header like

    SWIFT_CLASS("_TtC9Qualtrics29QualtricsSurveyViewController")

    So, The same thing I applied to the ApiDefinitions file

    [BaseType(typeof(UIViewController), Name = "_TtC9Qualtrics29QualtricsSurveyViewController")]

    And bingo!! it is working!!!

    This solution has fixed my all the issue and binding library is successfully working.

Sign In or Register to comment.