Ios 贝宝API错误

Ios 贝宝API错误,ios,objective-c,paypal,Ios,Objective C,Paypal,我正试图将PayPal API集成到我的iPhone应用程序中,但当我切换到处理它的控制器时,出现以下错误: -[UIDevice platformType]:发送到实例0xc25ff20的无法识别的选择器 2014-01-23 15:26:57.668 FuzzionStudio[27749:70b]***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[UIDevice platformType]:未识别的选择器发送到实例0xc25ff20'

我正试图将PayPal API集成到我的iPhone应用程序中,但当我切换到处理它的控制器时,出现以下错误:

-[UIDevice platformType]:发送到实例0xc25ff20的无法识别的选择器 2014-01-23 15:26:57.668 FuzzionStudio[27749:70b]***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[UIDevice platformType]:未识别的选择器发送到实例0xc25ff20'

还有其他人遇到过这个问题吗

#import "ZZMainViewController.h"
#import <QuartzCore/QuartzCore.h>

#warning "Enter your credentials"
#define kPayPalClientId @"YOUR CLIENT ID HERE"
#define kPayPalReceiverEmail @"YOUR_PAYPAL_EMAIL@yourdomain.com"

@interface ZZMainViewController ()

@property(nonatomic, strong, readwrite) IBOutlet UIButton *payButton;
@property(nonatomic, strong, readwrite) IBOutlet UIView *successView;

@end

@implementation ZZMainViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  self.title = @"Tuition Payment";
  self.acceptCreditCards = YES;
  self.environment = PayPalEnvironmentNoNetwork;
  // Do any additional setup after loading the view, typically from a nib.

  self.successView.hidden = YES;

  NSLog(@"PayPal iOS SDK version: %@", [PayPalPaymentViewController libraryVersion]);
}

- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:YES];

  UIEdgeInsets insets = UIEdgeInsetsMake(0, 15.0f, 0, 14.0f);
  UIImage *payBackgroundImage = [[UIImage imageNamed:@"button_secondary.png"] resizableImageWithCapInsets:insets];
  UIImage *payBackgroundImageHighlighted = [[UIImage imageNamed:@"button_secondary_selected.png"] resizableImageWithCapInsets:insets];
  [self.payButton setBackgroundImage:payBackgroundImage forState:UIControlStateNormal];
  [self.payButton setBackgroundImage:payBackgroundImageHighlighted forState:UIControlStateHighlighted];
  [self.payButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
  [self.payButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateHighlighted];

  // Optimization: Prepare for display of the payment UI by getting network work done early
  [PayPalPaymentViewController setEnvironment:self.environment];
  [PayPalPaymentViewController prepareForPaymentUsingClientId:kPayPalClientId];
}

- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
}
pragma标记-付款证明验证 pragma标记-PayPalPaymentDelegate方法 这里是贝宝的戴夫

@迈尔斯,你注意到集成说明中的这一点了吗

在项目的构建设置(在目标部分,而不是项目部分)中,将-lc++-ObjC添加到其他链接器标志


如果您以前没有注意到这一点,那么现在遵循该建议可以解决您的问题吗?

您的实际代码是什么样子的?抛出
NSInvalidArgumentException
的特定代码是什么?您是否使用自己的
[UIDevice platformType]
[UIDevice something]
?显示一些代码。您是否使用框架来执行此操作?框架是libPayPalMobile.a以及其他几个苹果创建的框架。编辑制作请参见上面的代码。Dave,感谢您的帮助。实际上,我已经从那里删除了-ObjC,因为当我将其保留在中时,我得到了以下错误:架构i386的未定义符号:“\u FBTokenInformationExpirationDateKey”,引用自:Parse(PFFacebookTokenCachingStrategy.o)中的-[PFFacebookTokenCachingStrategy cacheTokenInformation:]ld:symbol找不到架构i386的clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)正常。好。在谷歌搜索该错误后,似乎需要FacebookSDK.framework。我不确定是什么需要它,或者为什么需要它,但我把它包括在内,因为它一切正常。谢谢你让我走上了正确的方向。
- (IBAction)pay {

  // Remove our last completed payment, just for demo purposes.
  self.completedPayment = nil;

  PayPalPayment *payment = [[PayPalPayment alloc] init];
  payment.amount = [[NSDecimalNumber alloc] initWithString:@"9.95"];
  payment.currencyCode = @"USD";
  payment.shortDescription = @"Hipster t-shirt";

  if (!payment.processable) {
    // This particular payment will always be processable. If, for
    // example, the amount was negative or the shortDescription was
    // empty, this payment wouldn't be processable, and you'd want
    // to handle that here.
  }

  // Any customer identifier that you have will work here. Do NOT use a device- or
  // hardware-based identifier.
  NSString *customerId = @"user-11723";

  // Set the environment:
  // - For live charges, use PayPalEnvironmentProduction (default).
  // - To use the PayPal sandbox, use PayPalEnvironmentSandbox.
  // - For testing, use PayPalEnvironmentNoNetwork.
  [PayPalPaymentViewController setEnvironment:self.environment];

  PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithClientId:kPayPalClientId
                                                                                               receiverEmail:kPayPalReceiverEmail
                                                                                                     payerId:customerId
                                                                                                     payment:payment
                                                                                                    delegate:self];
  paymentViewController.hideCreditCardButton = !self.acceptCreditCards;

  // Setting the languageOrLocale property is optional.
  //
  // If you do not set languageOrLocale, then the PayPalPaymentViewController will present
  // its user interface according to the device's current language setting.
  //
  // Setting languageOrLocale to a particular language (e.g., @"es" for Spanish) or
  // locale (e.g., @"es_MX" for Mexican Spanish) forces the PayPalPaymentViewController
  // to use that language/locale.
  //
  // For full details, including a list of available languages and locales, see PayPalPaymentViewController.h.
  paymentViewController.languageOrLocale = @"en";

  [self presentViewController:paymentViewController animated:YES completion:nil];
}
- (void)sendCompletedPaymentToServer:(PayPalPayment *)completedPayment {
  // TODO: Send completedPayment.confirmation to server
  NSLog(@"Here is your proof of payment:\n\n%@\n\nSend this to your server for confirmation and fulfillment.", completedPayment.confirmation);
}
- (void)payPalPaymentDidComplete:(PayPalPayment *)completedPayment {
  NSLog(@"PayPal Payment Success!");
  self.completedPayment = completedPayment;
  self.successView.hidden = NO;

  [self sendCompletedPaymentToServer:completedPayment]; // Payment was processed successfully; send to server for verification and fulfillment
  [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)payPalPaymentDidCancel {
  NSLog(@"PayPal Payment Canceled");
  self.completedPayment = nil;
  self.successView.hidden = YES;
  [self dismissViewControllerAnimated:YES completion:nil];
}