1

我在 Xamarin iOS 中绑定 Account Kit iOS 框架。我使用 Objective Sharpie 成功生成了 ApiDefinition.cs 和 Structs.cs 文件,并在 Native References 中链接了本机 Account Kit 库。

当我在 Xamarin Studio 中构建项目时,出现此错误。

“/Projects/AccountKit/AccountKit/obj/Release/ios/AccountKit/AKFAccountKit.g.cs:错误 CS0246:找不到类型或命名空间名称 `AKFViewController'。您是否缺少程序集引用?(CS0246)(AccountKit )”。

我认为它要求将在 Account Kit 框架中使用的“视图控制器”。我该如何解决这个问题?

这是我的 Objective Sharpie 生成的“ApiDefinition.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);
    }

}

这是Objective 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
}
}
4

1 回答 1

1

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

interface IAKFViewController {}

然后使用这种接口类型代替原来的 Objective Sharpie 生成的接口。

于 2016-10-24T06:39:29.747 回答