绑定Xamarin中的PayPalMobile iOS库

时间:2016-04-06 22:22:21

标签: c# ios objective-c paypal xamarin.ios

我需要帮助绑定Xamarin中的PayPalMobile(objective-C)库。

我发现了几个PayPal绑定,但它们已过时并使用iOS8.x.我想将最新的PayPalMobile绑定到iOS9.2。

我跟踪Xamarin walkthrough绑定Objective-C库以帮助我绑定PayPalMobile库。

在演练之后,我将顶级头文件PayPalMobile.h传递给Objective Sharpie。我将Objective Sharpie生成的两个文件的内容(命名空间除外)复制到我的解决方案中并构建它。

建成后我收到了几个错误:

错误CS0246:找不到类型或命名空间名称“验证”。你错过了装配参考吗? (CS0246)

错误CS0246:找不到类型或命名空间名称“Native”。你错过了装配参考吗? (CS0246)

错误CS0579:属性'StaticAttribute'无法多次应用(CS0579)

现在,我的问题是:如何修复此错误?此外,属性:

BaseType,NullAllowed,Abstract,Wrap,Static,Verify,ConstantsInterfaceAssociation,StronglyTypedNSArray,PayPalPaymentViewControllerState,MethodToProperty

为红色,在当前上下文中不存在。我错过了一些资源吗?

假设上述错误是固定的。为了使用新的绑定,这将是一切吗?

ApiDefinitions:

using System;

using UIKit;
using Foundation;
using ObjCRuntime;
using CoreGraphics;

namespace PayPalMobileIOSBinding
{
    // @interface PayPalConfiguration : NSObject <NSCopying>
    [BaseType (typeof(NSObject))]
    interface PayPalConfiguration : INSCopying
    {
        // @property (readwrite, copy, nonatomic) NSString * _Nullable defaultUserEmail;
        [NullAllowed, Export ("defaultUserEmail")]
        string DefaultUserEmail { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable defaultUserPhoneCountryCode;
        [NullAllowed, Export ("defaultUserPhoneCountryCode")]
        string DefaultUserPhoneCountryCode { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable defaultUserPhoneNumber;
        [NullAllowed, Export ("defaultUserPhoneNumber")]
        string DefaultUserPhoneNumber { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable merchantName;
        [NullAllowed, Export ("merchantName")]
        string MerchantName { get; set; }

        // @property (readwrite, copy, nonatomic) NSURL * _Nullable merchantPrivacyPolicyURL;
        [NullAllowed, Export ("merchantPrivacyPolicyURL", ArgumentSemantic.Copy)]
        NSUrl MerchantPrivacyPolicyURL { get; set; }

        // @property (readwrite, copy, nonatomic) NSURL * _Nullable merchantUserAgreementURL;
        [NullAllowed, Export ("merchantUserAgreementURL", ArgumentSemantic.Copy)]
        NSUrl MerchantUserAgreementURL { get; set; }

        // @property (assign, readwrite, nonatomic) BOOL acceptCreditCards;
        [Export ("acceptCreditCards")]
        bool AcceptCreditCards { get; set; }

        // @property (assign, readwrite, nonatomic) PayPalShippingAddressOption payPalShippingAddressOption;
        [Export ("payPalShippingAddressOption", ArgumentSemantic.Assign)]
        PayPalShippingAddressOption PayPalShippingAddressOption { get; set; }

        // @property (assign, readwrite, nonatomic) BOOL rememberUser;
        [Export ("rememberUser")]
        bool RememberUser { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable languageOrLocale;
        [NullAllowed, Export ("languageOrLocale")]
        string LanguageOrLocale { get; set; }

        // @property (assign, readwrite, nonatomic) BOOL alwaysDisplayCurrencyCodes;
        [Export ("alwaysDisplayCurrencyCodes")]
        bool AlwaysDisplayCurrencyCodes { get; set; }

        // @property (assign, readwrite, nonatomic) BOOL disableBlurWhenBackgrounding;
        [Export ("disableBlurWhenBackgrounding")]
        bool DisableBlurWhenBackgrounding { get; set; }

        // @property (assign, readwrite, nonatomic) BOOL presentingInPopover;
        [Export ("presentingInPopover")]
        bool PresentingInPopover { get; set; }

        // @property (assign, readwrite, nonatomic) BOOL forceDefaultsInSandbox;
        [Export ("forceDefaultsInSandbox")]
        bool ForceDefaultsInSandbox { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable sandboxUserPassword;
        [NullAllowed, Export ("sandboxUserPassword")]
        string SandboxUserPassword { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable sandboxUserPin;
        [NullAllowed, Export ("sandboxUserPin")]
        string SandboxUserPin { get; set; }
    }

    // typedef void (^PayPalFuturePaymentDelegateCompletionBlock)();
    delegate void PayPalFuturePaymentDelegateCompletionBlock ();

    // @protocol PayPalFuturePaymentDelegate <NSObject>
    [Protocol, Model]
    [BaseType (typeof(NSObject))]
    interface PayPalFuturePaymentDelegate
    {
        // @required -(void)payPalFuturePaymentDidCancel:(PayPalFuturePaymentViewController * _Nonnull)futurePaymentViewController;
        [Abstract]
        [Export ("payPalFuturePaymentDidCancel:")]
        void PayPalFuturePaymentDidCancel (PayPalFuturePaymentViewController futurePaymentViewController);

        // @required -(void)payPalFuturePaymentViewController:(PayPalFuturePaymentViewController * _Nonnull)futurePaymentViewController didAuthorizeFuturePayment:(NSDictionary * _Nonnull)futurePaymentAuthorization;
        [Abstract]
        [Export ("payPalFuturePaymentViewController:didAuthorizeFuturePayment:")]
        void PayPalFuturePaymentViewController (PayPalFuturePaymentViewController futurePaymentViewController, NSDictionary futurePaymentAuthorization);

        // @optional -(void)payPalFuturePaymentViewController:(PayPalFuturePaymentViewController * _Nonnull)futurePaymentViewController willAuthorizeFuturePayment:(NSDictionary * _Nonnull)futurePaymentAuthorization completionBlock:(PayPalFuturePaymentDelegateCompletionBlock _Nonnull)completionBlock;
        [Export ("payPalFuturePaymentViewController:willAuthorizeFuturePayment:completionBlock:")]
        void PayPalFuturePaymentViewController (PayPalFuturePaymentViewController futurePaymentViewController, NSDictionary futurePaymentAuthorization, PayPalFuturePaymentDelegateCompletionBlock completionBlock);
    }

    // @interface PayPalFuturePaymentViewController : UINavigationController
    [BaseType (typeof(UINavigationController))]
    interface PayPalFuturePaymentViewController
    {
        // -(instancetype _Nullable)initWithConfiguration:(PayPalConfiguration * _Nonnull)configuration delegate:(id<PayPalFuturePaymentDelegate> _Nullable)delegate;
        [Export ("initWithConfiguration:delegate:")]
        IntPtr Constructor (PayPalConfiguration configuration, [NullAllowed] PayPalFuturePaymentDelegate @delegate);

        [Wrap ("WeakFuturePaymentDelegate")]
        [NullAllowed]
        PayPalFuturePaymentDelegate FuturePaymentDelegate { get; }

        // @property (readonly, nonatomic, weak) id<PayPalFuturePaymentDelegate> _Nullable futurePaymentDelegate;
        [NullAllowed, Export ("futurePaymentDelegate", ArgumentSemantic.Weak)]
        NSObject WeakFuturePaymentDelegate { get; }
    }

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

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

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

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

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

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

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

    // @interface PayPalPaymentDetails : NSObject <NSCopying>
    [BaseType (typeof(NSObject))]
    interface PayPalPaymentDetails : INSCopying
    {
        // +(PayPalPaymentDetails * _Nonnull)paymentDetailsWithSubtotal:(NSDecimalNumber * _Nullable)subtotal withShipping:(NSDecimalNumber * _Nullable)shipping withTax:(NSDecimalNumber * _Nullable)tax;
        [Static]
        [Export ("paymentDetailsWithSubtotal:withShipping:withTax:")]
        PayPalPaymentDetails PaymentDetailsWithSubtotal ([NullAllowed] NSDecimalNumber subtotal, [NullAllowed] NSDecimalNumber shipping, [NullAllowed] NSDecimalNumber tax);

        // @property (readwrite, copy, nonatomic) NSDecimalNumber * _Nullable subtotal;
        [NullAllowed, Export ("subtotal", ArgumentSemantic.Copy)]
        NSDecimalNumber Subtotal { get; set; }

        // @property (readwrite, copy, nonatomic) NSDecimalNumber * _Nullable shipping;
        [NullAllowed, Export ("shipping", ArgumentSemantic.Copy)]
        NSDecimalNumber Shipping { get; set; }

        // @property (readwrite, copy, nonatomic) NSDecimalNumber * _Nullable tax;
        [NullAllowed, Export ("tax", ArgumentSemantic.Copy)]
        NSDecimalNumber Tax { get; set; }
    }

    // @interface PayPalItem : NSObject <NSCopying>
    [BaseType (typeof(NSObject))]
    interface PayPalItem : INSCopying
    {
        // +(PayPalItem * _Nonnull)itemWithName:(NSString * _Nonnull)name withQuantity:(NSUInteger)quantity withPrice:(NSDecimalNumber * _Nonnull)price withCurrency:(NSString * _Nonnull)currency withSku:(NSString * _Nullable)sku;
        [Static]
        [Export ("itemWithName:withQuantity:withPrice:withCurrency:withSku:")]
        PayPalItem ItemWithName (string name, nuint quantity, NSDecimalNumber price, string currency, [NullAllowed] string sku);

        // +(NSDecimalNumber * _Nonnull)totalPriceForItems:(NSArray * _Nonnull)items;
        [Static]
        [Export ("totalPriceForItems:")]
        [Verify (StronglyTypedNSArray)]
        NSDecimalNumber TotalPriceForItems (NSObject[] items);

        // @property (readwrite, copy, nonatomic) NSString * _Nonnull name;
        [Export ("name")]
        string Name { get; set; }

        // @property (assign, readwrite, nonatomic) NSUInteger quantity;
        [Export ("quantity")]
        nuint Quantity { get; set; }

        // @property (readwrite, copy, nonatomic) NSDecimalNumber * _Nonnull price;
        [Export ("price", ArgumentSemantic.Copy)]
        NSDecimalNumber Price { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nonnull currency;
        [Export ("currency")]
        string Currency { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable sku;
        [NullAllowed, Export ("sku")]
        string Sku { get; set; }
    }

    // @interface PayPalShippingAddress : NSObject <NSCopying>
    [BaseType (typeof(NSObject))]
    interface PayPalShippingAddress : INSCopying
    {
        // +(PayPalShippingAddress * _Nonnull)shippingAddressWithRecipientName:(NSString * _Nonnull)recipientName withLine1:(NSString * _Nonnull)line1 withLine2:(NSString * _Nullable)line2 withCity:(NSString * _Nonnull)city withState:(NSString * _Nullable)state withPostalCode:(NSString * _Nullable)postalCode withCountryCode:(NSString * _Nonnull)countryCode;
        [Static]
        [Export ("shippingAddressWithRecipientName:withLine1:withLine2:withCity:withState:withPostalCode:withCountryCode:")]
        PayPalShippingAddress ShippingAddressWithRecipientName (string recipientName, string line1, [NullAllowed] string line2, string city, [NullAllowed] string state, [NullAllowed] string postalCode, string countryCode);

        // @property (readwrite, copy, nonatomic) NSString * _Nonnull recipientName;
        [Export ("recipientName")]
        string RecipientName { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nonnull line1;
        [Export ("line1")]
        string Line1 { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable line2;
        [NullAllowed, Export ("line2")]
        string Line2 { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nonnull city;
        [Export ("city")]
        string City { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable state;
        [NullAllowed, Export ("state")]
        string State { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable postalCode;
        [NullAllowed, Export ("postalCode")]
        string PostalCode { get; set; }

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

    // @interface PayPalPayment : NSObject <NSCopying>
    [BaseType (typeof(NSObject))]
    interface PayPalPayment : INSCopying
    {
        // +(PayPalPayment * _Nonnull)paymentWithAmount:(NSDecimalNumber * _Nonnull)amount currencyCode:(NSString * _Nonnull)currencyCode shortDescription:(NSString * _Nonnull)shortDescription intent:(PayPalPaymentIntent)intent;
        [Static]
        [Export ("paymentWithAmount:currencyCode:shortDescription:intent:")]
        PayPalPayment PaymentWithAmount (NSDecimalNumber amount, string currencyCode, string shortDescription, PayPalPaymentIntent intent);

        // @property (readwrite, copy, nonatomic) NSString * _Nonnull currencyCode;
        [Export ("currencyCode")]
        string CurrencyCode { get; set; }

        // @property (readwrite, copy, nonatomic) NSDecimalNumber * _Nonnull amount;
        [Export ("amount", ArgumentSemantic.Copy)]
        NSDecimalNumber Amount { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nonnull shortDescription;
        [Export ("shortDescription")]
        string ShortDescription { get; set; }

        // @property (assign, readwrite, nonatomic) PayPalPaymentIntent intent;
        [Export ("intent", ArgumentSemantic.Assign)]
        PayPalPaymentIntent Intent { get; set; }

        // @property (readwrite, copy, nonatomic) PayPalPaymentDetails * _Nullable paymentDetails;
        [NullAllowed, Export ("paymentDetails", ArgumentSemantic.Copy)]
        PayPalPaymentDetails PaymentDetails { get; set; }

        // @property (readwrite, copy, nonatomic) NSArray * _Nullable items;
        [NullAllowed, Export ("items", ArgumentSemantic.Copy)]
        [Verify (StronglyTypedNSArray)]
        NSObject[] Items { get; set; }

        // @property (readwrite, copy, nonatomic) PayPalShippingAddress * _Nullable shippingAddress;
        [NullAllowed, Export ("shippingAddress", ArgumentSemantic.Copy)]
        PayPalShippingAddress ShippingAddress { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable invoiceNumber;
        [NullAllowed, Export ("invoiceNumber")]
        string InvoiceNumber { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable custom;
        [NullAllowed, Export ("custom")]
        string Custom { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable softDescriptor;
        [NullAllowed, Export ("softDescriptor")]
        string SoftDescriptor { get; set; }

        // @property (readwrite, copy, nonatomic) NSString * _Nullable bnCode;
        [NullAllowed, Export ("bnCode")]
        string BnCode { get; set; }

        // @property (readonly, assign, nonatomic) BOOL processable;
        [Export ("processable")]
        bool Processable { get; }

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

        // @property (readonly, copy, nonatomic) NSDictionary * _Nonnull confirmation;
        [Export ("confirmation", ArgumentSemantic.Copy)]
        NSDictionary Confirmation { get; }
    }

    // typedef void (^PayPalPaymentDelegateCompletionBlock)();
    delegate void PayPalPaymentDelegateCompletionBlock ();

    // @protocol PayPalPaymentDelegate <NSObject>
    [Protocol, Model]
    [BaseType (typeof(NSObject))]
    interface PayPalPaymentDelegate
    {
        // @required -(void)payPalPaymentDidCancel:(PayPalPaymentViewController * _Nonnull)paymentViewController;
        [Abstract]
        [Export ("payPalPaymentDidCancel:")]
        void PayPalPaymentDidCancel (PayPalPaymentViewController paymentViewController);

        // @required -(void)payPalPaymentViewController:(PayPalPaymentViewController * _Nonnull)paymentViewController didCompletePayment:(PayPalPayment * _Nonnull)completedPayment;
        [Abstract]
        [Export ("payPalPaymentViewController:didCompletePayment:")]
        void PayPalPaymentViewController (PayPalPaymentViewController paymentViewController, PayPalPayment completedPayment);

        // @optional -(void)payPalPaymentViewController:(PayPalPaymentViewController * _Nonnull)paymentViewController willCompletePayment:(PayPalPayment * _Nonnull)completedPayment completionBlock:(PayPalPaymentDelegateCompletionBlock _Nonnull)completionBlock;
        [Export ("payPalPaymentViewController:willCompletePayment:completionBlock:")]
        void PayPalPaymentViewController (PayPalPaymentViewController paymentViewController, PayPalPayment completedPayment, PayPalPaymentDelegateCompletionBlock completionBlock);
    }

    // @interface PayPalPaymentViewController : UINavigationController
    [BaseType (typeof(UINavigationController))]
    interface PayPalPaymentViewController
    {
        // -(instancetype _Nullable)initWithPayment:(PayPalPayment * _Nonnull)payment configuration:(PayPalConfiguration * _Nullable)configuration delegate:(id<PayPalPaymentDelegate> _Nonnull)delegate;
        [Export ("initWithPayment:configuration:delegate:")]
        IntPtr Constructor (PayPalPayment payment, [NullAllowed] PayPalConfiguration configuration, PayPalPaymentDelegate @delegate);

        [Wrap ("WeakPaymentDelegate")]
        [NullAllowed]
        PayPalPaymentDelegate PaymentDelegate { get; }

        // @property (readonly, nonatomic, weak) id<PayPalPaymentDelegate> _Nullable paymentDelegate;
        [NullAllowed, Export ("paymentDelegate", ArgumentSemantic.Weak)]
        NSObject WeakPaymentDelegate { get; }

        // @property (readonly, assign, nonatomic) PayPalPaymentViewControllerState state;
        [Export ("state", ArgumentSemantic.Assign)]
        PayPalPaymentViewControllerState State { get; }
    }

    // typedef void (^PayPalProfileSharingDelegateCompletionBlock)();
    delegate void PayPalProfileSharingDelegateCompletionBlock ();

    // @protocol PayPalProfileSharingDelegate <NSObject>
    [Protocol, Model]
    [BaseType (typeof(NSObject))]
    interface PayPalProfileSharingDelegate
    {
        // @required -(void)userDidCancelPayPalProfileSharingViewController:(PayPalProfileSharingViewController * _Nonnull)profileSharingViewController;
        [Abstract]
        [Export ("userDidCancelPayPalProfileSharingViewController:")]
        void UserDidCancelPayPalProfileSharingViewController (PayPalProfileSharingViewController profileSharingViewController);

        // @required -(void)payPalProfileSharingViewController:(PayPalProfileSharingViewController * _Nonnull)profileSharingViewController userDidLogInWithAuthorization:(NSDictionary * _Nonnull)profileSharingAuthorization;
        [Abstract]
        [Export ("payPalProfileSharingViewController:userDidLogInWithAuthorization:")]
        void PayPalProfileSharingViewController (PayPalProfileSharingViewController profileSharingViewController, NSDictionary profileSharingAuthorization);

        // @optional -(void)payPalProfileSharingViewController:(PayPalProfileSharingViewController * _Nonnull)profileSharingViewController userWillLogInWithAuthorization:(NSDictionary * _Nonnull)profileSharingAuthorization completionBlock:(PayPalProfileSharingDelegateCompletionBlock _Nonnull)completionBlock;
        [Export ("payPalProfileSharingViewController:userWillLogInWithAuthorization:completionBlock:")]
        void PayPalProfileSharingViewController (PayPalProfileSharingViewController profileSharingViewController, NSDictionary profileSharingAuthorization, PayPalProfileSharingDelegateCompletionBlock completionBlock);
    }

    // @interface PayPalProfileSharingViewController : UINavigationController
    [BaseType (typeof(UINavigationController))]
    interface PayPalProfileSharingViewController
    {
        // -(instancetype _Nullable)initWithScopeValues:(NSSet * _Nonnull)scopeValues configuration:(PayPalConfiguration * _Nonnull)configuration delegate:(id<PayPalProfileSharingDelegate> _Nullable)delegate;
        [Export ("initWithScopeValues:configuration:delegate:")]
        IntPtr Constructor (NSSet scopeValues, PayPalConfiguration configuration, [NullAllowed] PayPalProfileSharingDelegate @delegate);

        [Wrap ("WeakProfileSharingDelegate")]
        [NullAllowed]
        PayPalProfileSharingDelegate ProfileSharingDelegate { get; }

        // @property (readonly, nonatomic, weak) id<PayPalProfileSharingDelegate> _Nullable profileSharingDelegate;
        [NullAllowed, Export ("profileSharingDelegate", ArgumentSemantic.Weak)]
        NSObject WeakProfileSharingDelegate { get; }
    }

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

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

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

    // @interface PayPalMobile : NSObject
    [BaseType (typeof(NSObject))]
    interface PayPalMobile
    {
        // +(void)initializeWithClientIdsForEnvironments:(NSDictionary * _Nonnull)clientIdsForEnvironments;
        [Static]
        [Export ("initializeWithClientIdsForEnvironments:")]
        void InitializeWithClientIdsForEnvironments (NSDictionary clientIdsForEnvironments);

        // +(void)preconnectWithEnvironment:(NSString * _Nonnull)environment;
        [Static]
        [Export ("preconnectWithEnvironment:")]
        void PreconnectWithEnvironment (string environment);

        // +(NSString * _Nonnull)clientMetadataID;
        [Static]
        [Export ("clientMetadataID")]
        [Verify (MethodToProperty)]
        string ClientMetadataID { get; }

        // +(NSString * _Nonnull)applicationCorrelationIDForEnvironment:(NSString * _Nonnull)environment __attribute__((deprecated("Use clientMetadataID instead.")));
        [Static]
        [Export ("applicationCorrelationIDForEnvironment:")]
        string ApplicationCorrelationIDForEnvironment (string environment);

        // +(void)clearAllUserData;
        [Static]
        [Export ("clearAllUserData")]
        void ClearAllUserData ();

        // +(NSString * _Nonnull)libraryVersion;
        [Static]
        [Export ("libraryVersion")]
        [Verify (MethodToProperty)]
        string LibraryVersion { get; }
    }
}

StructsAndEnums.cs

using System;
using ObjCRuntime;

namespace PayPalMobileIOSBinding
{
    [Native]
    public enum PayPalShippingAddressOption// : nint
    {
        None = 0,
        Provided = 1,
        PayPal = 2,
        Both = 3
    }

    [Native]
    public enum PayPalPaymentIntent// : nint
    {
        Sale = 0,
        Authorize = 1,
        Order = 2
    }

    [Native]
    public enum PayPalPaymentViewControllerState// : nint
    {
        Unsent = 0,
        InProgress = 1
    }
}

1 个答案:

答案 0 :(得分:2)

我已经在我的Github帐户中完成了这里的工作:https://github.com/AlejandroRuiz/PayPal.Forms/tree/master/Xamarin.PayPal.iOS

您可以根据它来查看您的错误,即。 verify属性表示您需要手动检查绑定数据类型/访问器等是否正确