0
votes

So i've been trying to create a Native Binding which can be used in Xamarin Forms, so its been fine, but there's one instance where i'm adding a new

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[BTDropInRequest setCardholderNameSetting:]: unrecognized selector sent to instance

This is my ApiDefinition class

[NullAllowed, Export("cardholderNameSetting", ArgumentSemantic.Strong)]
        BTFormFieldSetting CardHolderNameSetting { get; set; }

And i've defined BTFormFieldSetting in Structs as

 [Native]
public enum BTFormFieldSetting : long
{
    BTFormFieldDisabled ,
    BTFormFieldOptional,
    BTFormFieldRequired = 0
}

and this is my iOS Native equivalent

@property (nonatomic, assign) BTFormFieldSetting cardholderNameSetting;

and this what is defined for BTFormFieldSetting

    typedef NS_ENUM(NSInteger, BTFormFieldSetting) {
    BTFormFieldDisabled = 0,
    BTFormFieldOptional,
    BTFormFieldRequired
};

@interface BTDropInRequest : NSObject <NSCopying>

I've included the Native Framework for the Binding Library and if i do not use this piece of code it works fine Any Inputs would be deeply appreciated

2

2 Answers

0
votes

You are binding to an objective-C property of BTDropInRequest that does not @synthesize the property, thus it does not generate the setter and getter methods.

IOW, here is the Obj-C source in BTDropInRequest.h:

@property (nonatomic, assign) BTFormFieldSetting cardholderNameSetting;

Normally when doing this, one would use the @synthesize in the BTDropInRequest.m implementation file to automatically create the setCardHolderNameSetting: selector which allows you to set the property value with

[BTDropInRequest setCardholderNameSetting:<Instance of BTFormFieldSetting>]

and also create a cardholderNameSetting selector which allows one to get the property value. This is not done in the implementation file of BTDropInRequest. If it were you would see:

@synthesize cardholderNameSetting;

but it is not there, hence the error of the missing selector. Not sure how to fix this without changing the Obj-C source code.

0
votes

Wasn't related to anything technical, but rather needed to resolve all the dependencies related to this, once i did that, everything started working