引发了类型'Foundation.You_Should_Not_Call_base_In_This_Method'的异常

时间:2019-09-11 15:02:19

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

我想将freshChat集成到xamarin IOS中,所以我添加了IOS绑定库并添加了ApiDefinition,LibFDFreshChatSDK.a和Struct并从中创建了Dll。

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

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

  

“类型异常   “ Foundation.You_Should_Not_Call_base_In_This_Method被抛出”

// @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);
}

1 个答案:

答案 0 :(得分:0)

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

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