MBC870
MBC870

Reputation: 373

Cordova PayPal Plugin integration iOS issue

I have a mobile app with com.paypal.cordova.mobilesdk v3.5.0

I am getting the following error when creating payment in iOS.

Please also note that the app crashes and closes immediately when not in debug mode.

2018-09-02 20:48:29.853486+0200 MyHurryApp[631:122102] -[NSNull length]: unrecognized selector sent to instance 0x1b69ef878 2018-09-02 20:48:29.856680+0200 MyHurryApp[631:122102] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x1b69ef878' *** First throw call stack: (0x1843bad8c 0x1835745ec 0x1843c8098 0x1843c05c8 0x1842a641c 0x102ad75e8 0x1028c1c20 0x1033211dc 0x10332119c 0x103325d2c 0x184363070 0x184360bc8 0x184280da8 0x186266020 0x18e2a0758 0x1028beb90 0x183d11fc0) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

The line causing this crash seems to be: [PayPalMobile preconnectWithEnvironment:environmentToUse];

``` - (void)prepareToRender:(CDVInvokedUrlCommand *)command { [self.commandDelegate runInBackground:^{ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; NSString *environment = [command.arguments objectAtIndex:0];

NSString *environmentToUse = [self parseEnvironment:environment];
if (environmentToUse) {
  // save configuration
  PayPalConfiguration *configuration = [self getPayPalConfigurationFromDictionary:[command.arguments objectAtIndex:1]];
  self.configuration = configuration;
  // do preconnect
  dispatch_async(dispatch_get_main_queue(), ^{
    [PayPalMobile preconnectWithEnvironment:environmentToUse];
  });
} else {
  pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"The provided environment is not supported"];
}

[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];

}]; } ```

In other forums I've seen suggestions that you should convert the payment amount to string, which I did however the issue is still there. Click here for example

Any other suggestions please?

Upvotes: 0

Views: 269

Answers (1)

David
David

Reputation: 7507

Citing from the plugins readme:

Important: PayPal Mobile SDKs are now Deprecated and only existing integrations are supported. For all new integrations, use Braintree Direct in supported countries. In other countries, use Express Checkout and choose the Braintree SDK integration option.

The same warning is also shown at the paypal developer page.

So I guess your app is crashing at this:

[PayPalMobile preconnectWithEnvironment:environmentToUse];

position because you are trying to connect with a new environment, which is not supported anymore.

Most apps use the in-app-browser for realizing PayPal checkouts now.

Upvotes: 1

Related Questions