当前位置: 首页 > 知识库问答 >
问题:

在Xamarin中绑定Facebook账户套件iOS

邹麻雀
2023-03-14

我是绑定帐户工具包iOS框架在Xamarin iOS。我成功地使用Objective Sharpie生成了apidefinition.cs和structs.cs文件,并在本机引用中链接了本机帐户工具包库。

using System;
using Foundation;
using ObjCRuntime;
using UIKit;

namespace AccountKit
{
    // @protocol AKFAccessToken <NSObject, NSCopying, NSSecureCoding>
    [Protocol, Model]
    [BaseType(typeof(NSObject))]
    interface AKFAccessToken : INSCopying, INSSecureCoding
    {
        // @required @property (readonly, copy, nonatomic) NSString * _Nonnull accountID;
        [Abstract]
        [Export("accountID")]
        string AccountID { get; }

        // @required @property (readonly, copy, nonatomic) NSString * _Nonnull applicationID;
        [Abstract]
        [Export("applicationID")]
        string ApplicationID { get; }

        // @required @property (readonly, copy, nonatomic) NSDate * _Nonnull lastRefresh;
        [Abstract]
        [Export("lastRefresh", ArgumentSemantic.Copy)]
        NSDate LastRefresh { get; }

        // @required @property (readonly, assign, nonatomic) NSTimeInterval tokenRefreshInterval;
        [Abstract]
        [Export("tokenRefreshInterval")]
        double TokenRefreshInterval { get; }

        // @required @property (readonly, copy, nonatomic) NSString * _Nonnull tokenString;
        [Abstract]
        [Export("tokenString")]
        string TokenString { get; }
    }

    // @protocol AKFAccount <NSObject, NSCopying, NSSecureCoding>
    [Protocol, Model]
    [BaseType(typeof(NSObject))]
    interface AKFAccount : INSCopying, INSSecureCoding
    {
        // @required @property (readonly, copy, nonatomic) NSString * _Nonnull accountID;
        [Abstract]
        [Export("accountID")]
        string AccountID { get; }

        // @required @property (readonly, copy, nonatomic) NSString * _Nullable emailAddress;
        [Abstract]
        [NullAllowed, Export("emailAddress")]
        string EmailAddress { get; }

        // @required @property (readonly, copy, nonatomic) AKFPhoneNumber * _Nullable phoneNumber;
        [Abstract]
        [NullAllowed, Export("phoneNumber", ArgumentSemantic.Copy)]
        AKFPhoneNumber PhoneNumber { get; }
    }

    // @interface AKFAccountPreferences : NSObject
    [BaseType(typeof(NSObject))]
    [DisableDefaultCtor]
    interface AKFAccountPreferences
    {
        [Wrap("WeakDelegate")]
        [NullAllowed]
        AKFAccountPreferencesDelegate Delegate { get; set; }

        // @property (nonatomic, weak) id<AKFAccountPreferencesDelegate> _Nullable delegate;
        [NullAllowed, Export("delegate", ArgumentSemantic.Weak)]
        NSObject WeakDelegate { get; set; }

        // -(void)deletePreferenceForKey:(NSString * _Nonnull)key;
    [Export("deletePreferenceForKey:")]
        void DeletePreferenceForKey(string key);

        // -(void)loadPreferenceForKey:(NSString * _Nonnull)key;
        [Export("loadPreferenceForKey:")]
        void LoadPreferenceForKey(string key);

        // -(void)loadPreferences;
        [Export("loadPreferences")]
         void LoadPreferences();

        // -(void)setPreferenceForKey:(NSString * _Nonnull)key value:(NSString * _Nullable)value;
        [Export("setPreferenceForKey:value:")]
        void SetPreferenceForKey(string key, [NullAllowed] string value);
    }

    // @protocol AKFAccountPreferencesDelegate <NSObject>
    [Protocol, Model]
    [BaseType(typeof(NSObject))]
    interface AKFAccountPreferencesDelegate
    {
        // @optional -(void)accountPreferences:(AKFAccountPreferences * _Nonnull)accountPreferences didDeletePreferenceForKey:(NSString * _Nonnull)key error:(NSError * _Nullable)error;
        [Export("accountPreferences:didDeletePreferenceForKey:error:")]
        void DidDeletePreferenceForKey(AKFAccountPreferences accountPreferences, string key, [NullAllowed] NSError error);

        // @optional -(void)accountPreferences:(AKFAccountPreferences * _Nonnull)accountPreferences didLoadPreferences:(NSDictionary<NSString *,NSString *> * _Nullable)preferences error:(NSError * _Nullable)error;
        [Export("accountPreferences:didLoadPreferences:error:")]
        void DidLoadPreferences(AKFAccountPreferences accountPreferences, [NullAllowed] NSDictionary<NSString, NSString> preferences, [NullAllowed] NSError error);

        // @optional -(void)accountPreferences:(AKFAccountPreferences * _Nonnull)accountPreferences didLoadPreferenceForKey:(NSString * _Nonnull)key value:(NSString * _Nullable)value error:(NSError * _Nullable)error;
        [Export("accountPreferences:didLoadPreferenceForKey:value:error:")]
        void DidLoadPreferenceForKey(AKFAccountPreferences accountPreferences, string key, [NullAllowed] string value, [NullAllowed] NSError error);

        // @optional -(void)accountPreferences:(AKFAccountPreferences * _Nonnull)accountPreferences didSetPreferenceForKey:(NSString * _Nonnull)key value:(NSString * _Nonnull)value error:(NSError * _Nullable)error;
        [Export("accountPreferences:didSetPreferenceForKey:value:error:")]
        void DidSetPreferenceForKey(AKFAccountPreferences accountPreferences, string key, string value, [NullAllowed] NSError error);
    }

    [Static]
    partial interface Constants
    {
        // extern const NSUInteger AKFButtonTypeCount;
        [Field("AKFButtonTypeCount", "__Internal")]
        nuint AKFButtonTypeCount { get; }
    }

    partial interface Constants
    {
        // extern const NSUInteger AKFLoginFlowStateCount;
        [Field("AKFLoginFlowStateCount", "__Internal")]
        nuint AKFLoginFlowStateCount { get; }
    }

    partial interface Constants
    {
        // extern const NSUInteger AKFTextPositionCount;
        [Field("AKFTextPositionCount", "__Internal")]
        nuint AKFTextPositionCount { get; }
    }

    // @protocol AKFAdvancedUIActionController <NSObject>
    [Protocol, Model]
    [BaseType(typeof(NSObject))]
    interface AKFAdvancedUIActionController
    {
        // @required -(void)back;
        [Abstract]
        [Export("back")]
        void Back();

        // @required -(void)cancel;
        [Abstract]
        [Export("cancel")]
        void Cancel();
    }

    // @protocol AKFAdvancedUIManager <NSObject>
    [Protocol, Model]
    [BaseType(typeof(NSObject))]
    interface AKFAdvancedUIManager
    {
        // @optional -(UIView * _Nullable)actionBarViewForState:(AKFLoginFlowState)state;
        [Export("actionBarViewForState:")]
        [return: NullAllowed]
        UIView ActionBarViewForState(AKFLoginFlowState state);

        // @optional -(UIView * _Nullable)bodyViewForState:(AKFLoginFlowState)state;
        [Export("bodyViewForState:")]
        [return: NullAllowed]
        UIView BodyViewForState(AKFLoginFlowState state);

        // @optional -(AKFButtonType)buttonTypeForState:(AKFLoginFlowState)state;
        [Export("buttonTypeForState:")]
        AKFButtonType ButtonTypeForState(AKFLoginFlowState state);

        // @optional -(UIView * _Nullable)footerViewForState:(AKFLoginFlowState)state;
        [Export("footerViewForState:")]
        [return: NullAllowed]
        UIView FooterViewForState(AKFLoginFlowState state);

        // @optional -(UIView * _Nullable)headerViewForState:(AKFLoginFlowState)state;
        [Export("headerViewForState:")]
        [return: NullAllowed]
        UIView HeaderViewForState(AKFLoginFlowState state);

        // @optional -(void)setActionController:(id<AKFAdvancedUIActionController> _Nonnull)actionController;
        [Export("setActionController:")]
        void SetActionController(AKFAdvancedUIActionController actionController);

        // @optional -(void)setError:(NSError * _Nonnull)error;
        [Export("setError:")]
        void SetError(NSError error);

        // @optional -(AKFTextPosition)textPositionForState:(AKFLoginFlowState)state;
        [Export("textPositionForState:")]
        AKFTextPosition TextPositionForState(AKFLoginFlowState state);
    }

    // @protocol AKFAdvancedUIManaging <NSObject>
    [Protocol, Model]
    [BaseType(typeof(NSObject))]
    interface AKFAdvancedUIManaging
    {
        // @required @property (nonatomic, strong) id<AKFAdvancedUIManager> advancedUIManager;
        [Abstract]
        [Export("advancedUIManager", ArgumentSemantic.Strong)]
        AKFAdvancedUIManager AdvancedUIManager { get; set; }
    }

    // @protocol AKFConfiguring
    [Protocol, Model]
    interface AKFConfiguring
    {
        // @required @property (copy, nonatomic) NSArray<NSString *> * blacklistedCountryCodes;
        [Abstract]
        [Export("blacklistedCountryCodes", ArgumentSemantic.Copy)]
        string[] BlacklistedCountryCodes { get; set; }

        // @required @property (copy, nonatomic) NSString * defaultCountryCode;
        [Abstract]
        [Export("defaultCountryCode")]
        string DefaultCountryCode { get; set; }

        // @required @property (nonatomic) BOOL enableSendToFacebook;
        [Abstract]
        [Export("enableSendToFacebook")]
        bool EnableSendToFacebook { get; set; }

        // @required @property (copy, nonatomic) NSArray<NSString *> * whitelistedCountryCodes;
        [Abstract]
        [Export("whitelistedCountryCodes", ArgumentSemantic.Copy)]
        string[] WhitelistedCountryCodes { get; set; }
    }

    // @protocol AKFTheming
    [Protocol, Model]
    interface AKFTheming
    {
        // @required @property (copy, nonatomic) AKFTheme * _Null_unspecified theme __attribute__((annotate("ui_appearance_selector")));
        [Abstract]
        [Export("theme", ArgumentSemantic.Copy)]
        AKFTheme Theme { get; set; }
    }

    // @protocol AKFViewController <AKFAdvancedUIManaging, AKFConfiguring, AKFTheming>
    [Protocol, Model]
    interface AKFViewController : AKFAdvancedUIManaging, AKFConfiguring, AKFTheming
    {
        [Wrap("WeakDelegate"), Abstract]
        AKFViewControllerDelegate Delegate { get; set; }

        // @required @property (nonatomic, weak) id<AKFViewControllerDelegate> delegate;
        [Abstract]
        [NullAllowed, Export("delegate", ArgumentSemantic.Weak)]
        NSObject WeakDelegate { get; set; }

        // @required @property (readonly, assign, nonatomic) AKFLoginType loginType;
        [Abstract]
        [Export("loginType", ArgumentSemantic.Assign)]
        AKFLoginType LoginType { get; }
    }

    // @protocol AKFViewControllerDelegate <NSObject>
    [Protocol, Model]
    [BaseType(typeof(NSObject))]
    interface AKFViewControllerDelegate
    {
        // @optional -(void)viewController:(UIViewController<AKFViewController> *)viewController didCompleteLoginWithAuthorizationCode:(NSString *)code state:(NSString *)state;
        [Export("viewController:didCompleteLoginWithAuthorizationCode:state:")]
    void ViewController(AKFViewController viewController, string code, string state);

        // @optional -(void)viewController:(UIViewController<AKFViewController> *)viewController didCompleteLoginWithAccessToken:(id<AKFAccessToken>)accessToken state:(NSString *)state;
        [Export("viewController:didCompleteLoginWithAccessToken:state:")]
        void ViewController(AKFViewController viewController, AKFAccessToken accessToken, string state);

        // @optional -(void)viewController:(UIViewController<AKFViewController> *)viewController didFailWithError:(NSError *)error;
        [Export("viewController:didFailWithError:")]
        void ViewController(AKFViewController viewController, NSError error);

        // @optional -(void)viewControllerDidCancel:(UIViewController<AKFViewController> *)viewController;
        [Export("viewControllerDidCancel:")]
        void ViewControllerDidCancel(AKFViewController viewController);
    }

    // typedef void (^AKFRequestAccountHandler)(id<AKFAccount> _Nullable, NSError * _Nullable);
    delegate void AKFRequestAccountHandler([NullAllowed] AKFAccount arg0, [NullAllowed] NSError arg1);

    // @interface AKFAccountKit : NSObject
    [BaseType(typeof(NSObject))]
    [DisableDefaultCtor]
    interface AKFAccountKit
    {
        // +(NSString * _Nonnull)graphVersionString;
        [Static]
        [Export("graphVersionString")]
        string GraphVersionString { get; }

        // +(NSString * _Nonnull)versionString;
        [Static]
        [Export("versionString")]
        string VersionString { get; }

        // @property (readonly, copy, nonatomic) id<AKFAccessToken> _Nullable currentAccessToken;
        [NullAllowed, Export("currentAccessToken", ArgumentSemantic.Copy)]
        AKFAccessToken CurrentAccessToken { get; }

        // -(instancetype _Nonnull)initWithResponseType:(AKFResponseType)responseType __attribute__((objc_designated_initializer));
        [Export("initWithResponseType:")]
        [DesignatedInitializer]
        IntPtr Constructor(AKFResponseType responseType);

        // -(AKFAccountPreferences * _Nullable)accountPreferences;
        [NullAllowed, Export("accountPreferences")]
        AKFAccountPreferences AccountPreferences { get; }

        // -(void)cancelLogin;
        [Export("cancelLogin")]
        void CancelLogin();

        // -(void)logOut;
        [Export("logOut")]
        void LogOut();

        // -(void)requestAccount:(AKFRequestAccountHandler _Nonnull)handler;
        [Export("requestAccount:")]
        void RequestAccount(AKFRequestAccountHandler handler);

        // -(UIViewController<AKFViewController> * _Nonnull)viewControllerForEmailLogin;
        [Export("viewControllerForEmailLogin")]
        AKFViewController ViewControllerForEmailLogin { get; }

        // -(UIViewController<AKFViewController> * _Nonnull)viewControllerForEmailLoginWithEmail:(NSString * _Nullable)email state:(NSString * _Nullable)state;
        [Export("viewControllerForEmailLoginWithEmail:state:")]
        AKFViewController ViewControllerForEmailLoginWithEmail([NullAllowed] string email, [NullAllowed] string state);

        // -(UIViewController<AKFViewController> * _Nonnull)viewControllerForPhoneLogin;
        [Export("viewControllerForPhoneLogin")]
        AKFViewController ViewControllerForPhoneLogin { get; }

        // -(UIViewController<AKFViewController> * _Nonnull)viewControllerForPhoneLoginWithPhoneNumber:(AKFPhoneNumber * _Nullable)phoneNumber state:(NSString * _Nullable)state;
        [Export("viewControllerForPhoneLoginWithPhoneNumber:state:")]
        AKFViewController ViewControllerForPhoneLoginWithPhoneNumber([NullAllowed] AKFPhoneNumber phoneNumber, [NullAllowed] string state);

        // -(UIViewController<AKFViewController> * _Nullable)viewControllerForLoginResume;
        [NullAllowed, Export("viewControllerForLoginResume")]
        AKFViewController ViewControllerForLoginResume { get; }
    }

    partial interface Constants
    {
        // extern NSString *const _Nonnull AKFErrorDomain;
        [Field("AKFErrorDomain", "__Internal")]
        NSString AKFErrorDomain { get; }

        // extern NSString *const _Nonnull AKFErrorDeveloperMessageKey;
        [Field("AKFErrorDeveloperMessageKey", "__Internal")]
        NSString AKFErrorDeveloperMessageKey { get; }

        // extern NSString *const _Nonnull AKFErrorUserMessageKey;
        [Field("AKFErrorUserMessageKey", "__Internal")]
        NSString AKFErrorUserMessageKey { get; }

        // extern NSString *const _Nonnull AKFErrorObjectKey;
        [Field("AKFErrorObjectKey", "__Internal")]
        NSString AKFErrorObjectKey { get; }
   }

    partial interface Constants
    {
        // extern NSString *const _Nonnull AKFServerErrorDomain;
        [Field("AKFServerErrorDomain", "__Internal")]
        NSString AKFServerErrorDomain { get; }
    }

    // @interface AKFPhoneNumber : NSObject <NSCopying, NSSecureCoding>
    [BaseType(typeof(NSObject))]
    [DisableDefaultCtor]
    interface AKFPhoneNumber : INSCopying, INSSecureCoding
    {
        // -(instancetype _Nonnull)initWithCountryCode:(NSString * _Nonnull)countryCode phoneNumber:(NSString * _Nonnull)phoneNumber __attribute__((objc_designated_initializer));
        [Export("initWithCountryCode:phoneNumber:")]
        [DesignatedInitializer]
        IntPtr Constructor(string countryCode, string phoneNumber);

        // @property (readonly, copy, nonatomic) NSString * _Nonnull countryCode;
        [Export("countryCode")]
        string CountryCode { get; }

        // @property (readonly, copy, nonatomic) NSString * _Nonnull phoneNumber;
        [Export("phoneNumber")]
        string PhoneNumber { get; }

        // -(BOOL)isEqualToPhoneNumber:(AKFPhoneNumber * _Nonnull)phoneNumber;
        [Export("isEqualToPhoneNumber:")]
        bool IsEqualToPhoneNumber(AKFPhoneNumber phoneNumber);

        // -(NSString * _Nonnull)stringRepresentation;
        [Export("stringRepresentation")]
        string StringRepresentation { get; }
    }

    // @interface AKFSettings : NSObject
    [BaseType(typeof(NSObject))]
    interface AKFSettings
    {
        // +(NSString * _Nonnull)clientToken;
        // +(void)setClientToken:(NSString * _Nonnull)clientToken;
        [Static]
        [Export("clientToken")]
        string ClientToken { get; set; }
    }

    partial interface Constants
    {
        // extern const NSUInteger AKFHeaderTextTypeCount;
        [Field("AKFHeaderTextTypeCount", "__Internal")]
        nuint AKFHeaderTextTypeCount { get; }
    }

    // @interface AKFTheme : NSObject <NSCopying>
    [BaseType(typeof(NSObject))]
    interface AKFTheme : INSCopying
    {
        // +(instancetype _Nonnull)defaultTheme;
        [Static]
        [Export("defaultTheme")]
        AKFTheme DefaultTheme();

        // +(instancetype _Nonnull)outlineTheme;
        [Static]
        [Export("outlineTheme")]
        AKFTheme OutlineTheme();

        // +(instancetype _Nonnull)outlineThemeWithPrimaryColor:(UIColor * _Nonnull)primaryColor primaryTextColor:(UIColor * _Nonnull)primaryTextColor secondaryTextColor:(UIColor * _Nonnull)secondaryTextColor statusBarStyle:(UIStatusBarStyle)statusBarStyle;
        [Static]
        [Export("outlineThemeWithPrimaryColor:primaryTextColor:secondaryTextColor:statusBarStyle:")]
        AKFTheme OutlineThemeWithPrimaryColor(UIColor primaryColor, UIColor primaryTextColor, UIColor secondaryTextColor, UIStatusBarStyle statusBarStyle);

        // +(instancetype _Nonnull)themeWithPrimaryColor:(UIColor * _Nonnull)primaryColor primaryTextColor:(UIColor * _Nonnull)primaryTextColor secondaryColor:(UIColor * _Nonnull)secondaryColor secondaryTextColor:(UIColor * _Nonnull)secondaryTextColor statusBarStyle:(UIStatusBarStyle)statusBarStyle;
        [Static]
        [Export("themeWithPrimaryColor:primaryTextColor:secondaryColor:secondaryTextColor:statusBarStyle:")]
        AKFTheme ThemeWithPrimaryColor(UIColor primaryColor, UIColor primaryTextColor, UIColor secondaryColor, UIColor secondaryTextColor, UIStatusBarStyle statusBarStyle);

        // @property (copy, nonatomic) UIColor * _Nonnull backgroundColor;
        [Export("backgroundColor", ArgumentSemantic.Copy)]
        UIColor BackgroundColor { get; set; }

        // @property (copy, nonatomic) UIImage * _Nullable backgroundImage;
        [NullAllowed, Export("backgroundImage", ArgumentSemantic.Copy)]
        UIImage BackgroundImage { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonBackgroundColor;
        [Export("buttonBackgroundColor", ArgumentSemantic.Copy)]
        UIColor ButtonBackgroundColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonBorderColor;
        [Export("buttonBorderColor", ArgumentSemantic.Copy)]
        UIColor ButtonBorderColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonDisabledBackgroundColor;
        [Export("buttonDisabledBackgroundColor", ArgumentSemantic.Copy)]
        UIColor ButtonDisabledBackgroundColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonDisabledBorderColor;
        [Export("buttonDisabledBorderColor", ArgumentSemantic.Copy)]
        UIColor ButtonDisabledBorderColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonDisabledTextColor;
        [Export("buttonDisabledTextColor", ArgumentSemantic.Copy)]
        UIColor ButtonDisabledTextColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonHighlightedBackgroundColor;
        [Export("buttonHighlightedBackgroundColor", ArgumentSemantic.Copy)]
        UIColor ButtonHighlightedBackgroundColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonHighlightedBorderColor;
        [Export("buttonHighlightedBorderColor", ArgumentSemantic.Copy)]
        UIColor ButtonHighlightedBorderColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonHighlightedTextColor;
        [Export("buttonHighlightedTextColor", ArgumentSemantic.Copy)]
        UIColor ButtonHighlightedTextColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull buttonTextColor;
        [Export("buttonTextColor", ArgumentSemantic.Copy)]
        UIColor ButtonTextColor { get; set; }

        // @property (assign, nonatomic) NSUInteger contentBodyLayoutWeight;
        [Export("contentBodyLayoutWeight")]
        nuint ContentBodyLayoutWeight { get; set; }

        // @property (assign, nonatomic) NSUInteger contentBottomLayoutWeight;
        [Export("contentBottomLayoutWeight")]
        nuint ContentBottomLayoutWeight { get; set; }

        // @property (assign, nonatomic) NSUInteger contentFooterLayoutWeight;
        [Export("contentFooterLayoutWeight")]
        nuint ContentFooterLayoutWeight { get; set; }

        // @property (assign, nonatomic) NSUInteger contentHeaderLayoutWeight;
        [Export("contentHeaderLayoutWeight")]
        nuint ContentHeaderLayoutWeight { get; set; }

        // @property (assign, nonatomic) CGFloat contentMarginLeft;
        [Export("contentMarginLeft")]
        nfloat ContentMarginLeft { get; set; }

        // @property (assign, nonatomic) CGFloat contentMarginRight;
        [Export("contentMarginRight")]
        nfloat ContentMarginRight { get; set; }

        // @property (assign, nonatomic) CGFloat contentMaxWidth;
        [Export("contentMaxWidth")]
        nfloat ContentMaxWidth { get; set; }

        // @property (assign, nonatomic) CGFloat contentMinHeight;
        [Export("contentMinHeight")]
        nfloat ContentMinHeight { get; set; }

        // @property (assign, nonatomic) NSUInteger contentTextLayoutWeight;
        [Export("contentTextLayoutWeight")]
       nuint ContentTextLayoutWeight { get; set; }

        // @property (assign, nonatomic) NSUInteger contentTopLayoutWeight;
        [Export("contentTopLayoutWeight")]
        nuint ContentTopLayoutWeight { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull headerBackgroundColor;
        [Export("headerBackgroundColor", ArgumentSemantic.Copy)]
        UIColor HeaderBackgroundColor { get; set; }

        // @property (nonatomic, strong) UIColor * _Nonnull headerButtonTextColor;
        [Export("headerButtonTextColor", ArgumentSemantic.Strong)]
        UIColor HeaderButtonTextColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull headerTextColor;
        [Export("headerTextColor", ArgumentSemantic.Copy)]
        UIColor HeaderTextColor { get; set; }

         // @property (assign, nonatomic) AKFHeaderTextType headerTextType;
        [Export("headerTextType", ArgumentSemantic.Assign)]
        AKFHeaderTextType HeaderTextType { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull iconColor;
        [Export("iconColor", ArgumentSemantic.Copy)]
        UIColor IconColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull inputBackgroundColor;
        [Export("inputBackgroundColor", ArgumentSemantic.Copy)]
        UIColor InputBackgroundColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull inputBorderColor;
        [Export("inputBorderColor", ArgumentSemantic.Copy)]
        UIColor InputBorderColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull inputTextColor;
        [Export("inputTextColor", ArgumentSemantic.Copy)]
        UIColor InputTextColor { get; set; }

        // @property (assign, nonatomic) UIStatusBarStyle statusBarStyle;
        [Export("statusBarStyle", ArgumentSemantic.Assign)]
        UIStatusBarStyle StatusBarStyle { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull textColor;
        [Export("textColor", ArgumentSemantic.Copy)]
        UIColor TextColor { get; set; }

        // @property (copy, nonatomic) UIColor * _Nonnull titleColor;
        [Export("titleColor", ArgumentSemantic.Copy)]
        UIColor TitleColor { get; set; }

        // -(BOOL)isEqualToTheme:(AKFTheme * _Nonnull)theme;
        [Export("isEqualToTheme:")]
        bool IsEqualToTheme(AKFTheme theme);
    }

}

下面是目标Sharpie的“structs.cs”代码。

using System;
using ObjCRuntime;

namespace AccountKit
{
[Native]
public enum AKFResponseType : ulong
{
    AccessToken = 0,
    uthorizationCode
}

[Native]
public enum AKFButtonType : ulong
{
    Default = 0,
    Begin,
    Confirm,
    Continue,
    LogIn,
    Next,
    Ok,
    Send,
    Start,
    Submit
}

[Native]
public enum AKFLoginFlowState : ulong
{
    None = 0,
    PhoneNumberInput,
    EmailInput,
    EmailVerify,
    SendingCode,
    SentCode,
    CodeInput,
    VerifyingCode,
    Verified,
    Error,
    ResendCode
}

[Native]
public enum AKFTextPosition : ulong
{
    Default = 0,
    AboveBody,
    BelowBody
}

[Native]
public enum AKFLoginType : ulong
{
    Email = 0,
    Phone
}

[Native]
public enum AKFErrorCode : int
{
    NetworkConnectionError = 100,
    ServerError = 200,
    LoginRequestInvalidatedError = 300,
    InvalidParameterValueError = 400
}

[Native]
public enum AKFServerErrorCode : int
{
    AKFInvalidServerParameterValueError = 201
}

[Native]
public enum AKFLoginRequestInvalidatedErrorCode : int
{
    AKFLoginRequestExpiredError = 301
}

[Native]
public enum AKFInvalidParameterValueErrorCode : int
{
    InvalidEmailAddressError = 401,
    InvalidPhoneNumberError = 402,
    InvalidCodingValueError = 403,
    InvalidAccessTokenError = 404,
    InvalidAccountPreferenceKeyError = 405,
    InvalidAccountPreferenceValueError = 406,
    OperationNotSuccessful = 407
}

[Native]
public enum AKFServerResponseErrorCode : int
{
    AKFServerResponseErrorCodeInvalidConfirmationCode = 15003
}

[Native]
public enum AKFHeaderTextType : ulong
{
    Login = 0,
    AppName
}
}

共有1个答案

越国源
2023-03-14

我找出了我的问题,终于找到了解决办法。因此,Objective Sharpie将AKFViewController协议转换为C#接口,其他函数使用AKFViewController类型作为参数和返回类型。因此,为了使用接口类型,我们必须创建一个带有I前缀的空接口,如下所示:

interface IAKFViewController {}

然后用这个接口类型代替原来的目标Sharpie生成的接口。

 类似资料:
  • 说明api接口绑定收款账户 请求地址 http://api.dc78.cn/Api/sys_bindCollectionAccount 请求方式 POST 请求参数 参数 参数名称 描述 src 支付通道类型 微信:wx 支付宝:ali obj_key 绑定对象key 门店:门店编号 总部(充值、团购):0 微信红包:redPack account_id 收款账号ID 接口 11.4获取可绑定收款

  • 如果我进入obj/release/generated/src,我可以找到IApplicationSelectionListener,所以它被创建了一些绑定,但实际上它并不工作。有人能给我指出正确的方向吗?我需要做些什么来纠正这样的错误? 谢谢

  • 现在,我正在尝试让ListView具有一些可绑定的CustomCells。我将XAML中的单元格定义为DataTemplate下的ViewCell和ListView.ItemTemplate下的ViewCell。 为了简单起见,让我们假设我在单元格中表示了两个字符串。ViewCell看起来如下所示: 编辑1: 我尝试编写一个模仿一些示例的文件,但这还不够。没有一段代码解释该文件是XAML中表示Vi

  • 我试图创建一个Xamarin Android绑定库,它引用org.apache.xml.security.transforms,org.apache.xml.security.algorithes 我必须添加哪个引用来确保它工作正常? 样本误差 1>BindingsGenerator:警告BG8900:类型org.apache.xml.security.transforms.transforms:

  • 我正在尝试为库生成Xamarin绑定: https://github.com/noties/markwon https://repo1.maven.org/maven2/io/noties/markwon/core/4.6.1/core-4.6.1.aar 我还没有修改或任何内容。我已经将aar添加为,但是在尝试编译它时遇到了一些问题。 0>obj/debug/generated/src/io.n

  • 我有一个带有Kotlin代码的Android绑定库,每当它命中Kotlin代码中的runBlocking{}时就会退出。 E(28583:28691)错误[19]-辅助线程捕获到异常:无法解析:lkotlinx/coroutines/builderskt;E(28583:28691)java.lang.NoClassDefoundError:无法解析:lkotLinx/coroutines/bui