c# - 抛出 'Foundation.You_Should_Not_Call_base_In_This_Method' 类型的异常

标签 c# xamarin xamarin.forms xamarin.ios xamarin-binding

我要整合freshChat在 xamarin IOS 中,所以我添加了 IOS 绑定(bind)库并从中添加了 ApiDefinition、LibFDFreshChatSDK.a & Struct 和 Create Dll。

复制生成的 DLL 并在 Xamarin IOS 中添加引用。

当我通过在参数中传递 AppId 和 AppKey 创建 FreshchatConfig 的对象时,它抛出异常

"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);
}

最佳答案

尝试从 FreshchatConfig 的 API 定义中删除 [Model],例如:

// @interface FreshchatConfig : NSObject
[BaseType(typeof(NSObject))]
public interface FreshchatConfig

关于c# - 抛出 'Foundation.You_Should_Not_Call_base_In_This_Method' 类型的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57891963/

相关文章:

c# - 如何从我的数据库(formview)中检索数据并将其相乘,visual studio

c# - 以编程方式将用户控件添加到工具箱时出现问题

c# - 使用 UML 显示递归方法

xamarin.android - PCL 上的 TPL 用于 MvvmCross for PCL Profile 78

c# - 致命信号 6 (SIGABRT),tid 13929 (.AppTest.Project1) 中的代码 -6 (SI_TKILL),pid 13929 (.AppTest.Project1)

c# - 如何在 Xamarin Forms 中使用相机拍摄多张照片?

xaml - 如何使用 Xaml 将上标添加到 Xamarin Forms 中的标签

c# - 是否可以通过 P/Invoke 从 C# 使用 D?

xamarin - 如何将 Xamarin Forms new shell 与 Prism 集成?

Xamarin.Forms:在子文件夹中组织图像