2

I want to integrate freshChat in xamarin IOS so I added IOS binding library and added ApiDefinition, LibFDFreshChatSDK.a & Struct and Create Dll from it.

Copy the generated DLL and added a reference in Xamarin IOS.

When I create an object of FreshchatConfig by passing AppId and AppKey in parameter it throws exception

"Exception of type 'Foundation.You_Should_Not_Call_base_In_This_Method' was thrown"

// @interface FreshchatConfig : NSObject
[BaseType(typeof(NSObject))]
[Model]
public interface FreshchatConfig
{
    // @property (nonatomic, strong) NSString * appID;
    [Export("appID", ArgumentSemantic.Strong)]
    string AppID { get; set; }

    // @property (nonatomic, strong) NSString * appKey;
    [Export("appKey", ArgumentSemantic.Strong)]
    string AppKey { get; set; }

    // @property (nonatomic, strong) NSString * domain;
    [Export("domain", ArgumentSemantic.Strong)]
    string Domain { get; set; }

    // @property (nonatomic, strong) NSString * themeName;
    [Export("themeName", ArgumentSemantic.Strong)]
    string ThemeName { get; set; }

    // @property (nonatomic, strong) NSString * stringsBundle;
    [Export("stringsBundle", ArgumentSemantic.Strong)]
    string StringsBundle { get; set; }

    // @property (assign, nonatomic) BOOL gallerySelectionEnabled;
    [Export("gallerySelectionEnabled")]
    bool GallerySelectionEnabled { get; set; }

    // @property (assign, nonatomic) BOOL cameraCaptureEnabled;
    [Export("cameraCaptureEnabled")]
    bool CameraCaptureEnabled { get; set; }

    // @property (assign, nonatomic) BOOL notificationSoundEnabled;
    [Export("notificationSoundEnabled")]
    bool NotificationSoundEnabled { get; set; }

    // @property (assign, nonatomic) BOOL teamMemberInfoVisible;
    [Export("teamMemberInfoVisible")]
    bool TeamMemberInfoVisible { get; set; }

    // @property (assign, nonatomic) BOOL showNotificationBanner;
    [Export("showNotificationBanner")]
    bool ShowNotificationBanner { get; set; }

    // @property (assign, nonatomic) BOOL responseExpectationVisible;
    [Export("responseExpectationVisible")]
    bool ResponseExpectationVisible { get; set; }

    // -(instancetype)initWithAppID:(NSString *)appID andAppKey:(NSString 
    *)appKey;
    [Export("initWithAppID:andAppKey:")]
    IntPtr Constructor(string appID, string appKey);
}
Sagar Shirke
  • 648
  • 9
  • 32
  • 1
    My guess would be that the generated C# code for the constructor is calling base(appID, appKey) on the constructor, but this should be fine so not sure why you are getting that. If needed, you can open a free Xamarin support case with microsoft: You can open a free Xamarin support case here: https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6 . – jgoldberger - MSFT Sep 11 '19 at 19:38
  • 1
    When i Dig into Dll i find that freshchatConfig Class constructor Call Base(NSObject) Class constructor by passing NSObjectFlag.Empty in parameter – Dhiraj poojary Sep 13 '19 at 06:10

1 Answers1

0

Try removing [Model] from the API definition for FreshchatConfig, e.g.:

// @interface FreshchatConfig : NSObject
[BaseType(typeof(NSObject))]
public interface FreshchatConfig
jgoldberger - MSFT
  • 5,978
  • 2
  • 20
  • 44