title: PayPal API error
body: <p>I'm trying to integrate the PayPal API into my iPhone app but when I segue to the controller that handles it I get the following error: </p>
  
  <blockquote>
    <p>-[UIDevice platformType]: unrecognized selector sent to instance 0xc25ff20
    2014-01-23 15:26:57.668 FuzionStudio[27749:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDevice platformType]: unrecognized selector sent to instance 0xc25ff20'</p>
  </blockquote>
  
  <p>Has anyone else run into this issue?</p>
  
  <pre><code>#import "ZZMainViewController.h"
  #import &lt;QuartzCore/QuartzCore.h&gt;
  
  #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.
  }
  </code></pre>
  
  <h1>pragma mark - Pay action</h1>
  
  <pre><code>- (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];
  }
  </code></pre>
  
  <h1>pragma mark - Proof of payment validation</h1>
  
  <pre><code>- (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);
  }
  </code></pre>
  
  <h1>pragma mark - PayPalPaymentDelegate methods</h1>
  
  <pre><code>- (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];
  }
  </code></pre>