Problems with Ionic 4 and Braintree on iOS - App Crashes

hello!

I really need your help :frowning:
I’m doing an app with Ionic 4 and cordova-plugin-braintree version 0.5.1 (i tried the other forks but i can’t compile).

With Android everything works fine.

With iOs i’m having trouble making it work:

I can access the paypal account, choose the card and the payment method but when i choose to pay the app crashes and i get this error:

2020-03-03 10:45:27.414499+0100 Single Fin App[53289:11332367] Connection 7: unable to determine interface type without an established connection
2020-03-03 10:45:27.414547+0100 Single Fin App[53289:11332367] Connection 7: unable to determine fallback status without a connection
2020-03-03 10:45:29.186 Single Fin App[53289:11316095] Untrusted SSL certificate chain. Refusing to communicate with PayPal servers.
2020-03-03 10:45:29.189591+0100 Single Fin App[53289:11332366] Task <01FE38F8-CD3E-478A-ADEE-5CFD2F8E8994>.<0> HTTP load failed, 0/0 bytes (error code: -999 [1:89])
2020-03-03 10:45:36.659198+0100 Single Fin App[53289:11316095] CDVIonicKeyboard: updating frame
2020-03-03 10:45:39.434503+0100 Single Fin App[53289:11316095] CDVIonicKeyboard: updating frame
2020-03-03 10:45:43.809588+0100 Single Fin App[53289:11316095] CDVIonicKeyboard: updating frame
2020-03-03 10:45:49.196546+0100 Single Fin App[53289:11316095] CDVIonicKeyboard: updating frame
2020-03-03 10:45:55.487106+0100 Single Fin App[53289:11316095] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]’
*** First throw call stack:
(
0 CoreFoundation 0x00000001036ed27e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x0000000101d00b20 objc_exception_throw + 48
2 CoreFoundation 0x000000010377fab1 _CFThrowFormattedException + 194
3 CoreFoundation 0x000000010378a4c6 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.4 + 38
4 CoreFoundation 0x000000010374ad97 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 247
5 CoreFoundation 0x00000001036e912b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
6 Single Fin App 0x0000000100b58ff8 -[BraintreePlugin getPaymentUINonceResult:] + 1928
7 Single Fin App 0x0000000100b58597 -[BraintreePlugin dropInViewController:didSucceedWithTokenization:] + 183
8 BraintreeUI 0x000000010106c610 -[BTDropInViewController informDelegateDidAddPaymentInfo:] + 140
9 BraintreeUI 0x000000010106e4b5 -[BTDropInViewController paymentButtonDidCompleteTokenization:fromViewController:error:] + 266
10 BraintreeUI 0x0000000101069256 __44-[BTDropInViewController initWithAPIClient:]_block_invoke + 82
11 BraintreePayPal 0x0000000100fd4697 __57-[BTPayPalDriver setAppSwitchReturnBlock:forPaymentType:]_block_invoke_3 + 254
12 libdispatch.dylib 0x0000000105d78dd4 _dispatch_call_block_and_release + 12
13 libdispatch.dylib 0x0000000105d79d48 _dispatch_client_callout + 8
14 libdispatch.dylib 0x0000000105d87de6 _dispatch_main_queue_callback_4CF + 1500
15 CoreFoundation 0x0000000103650049 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
16 CoreFoundation 0x000000010364aca9 __CFRunLoopRun + 2329
17 CoreFoundation 0x000000010364a066 CFRunLoopRunSpecific + 438
18 GraphicsServices 0x0000000108bcdbb0 GSEventRunModal + 65
19 UIKitCore 0x000000010c0fdd4d UIApplicationMain + 1621
20 Single Fin App 0x0000000100b56811 main + 65
21 libdyld.dylib 0x0000000105e01c25 start + 1
22 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

this is my AppDelegate file

@implementation AppDelegate

  • (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    {
    self.viewController = [[MainViewController alloc] init];
    [BTAppSwitch setReturnURLScheme:@“com.nastydevops.singlefin.payments”];
    return [super application:application didFinishLaunchingWithOptions:launchOptions];

}

  • (BOOL)application:(UIApplication *)application
    openURL:(NSURL *)url
    options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    if ([url.scheme localizedCaseInsensitiveCompare:@“com.nastydevops.singlefin.payments”] == NSOrderedSame) {
    return [BTAppSwitch handleOpenURL:url options:options];
    }
    return NO;
    }

@EnD

Do you have any idea?

thanks!

Hi, We had issue that PayPal plugin didn’t worked on iOS and we discovered that it was because of using Capacitor. When we used Ionic with Cordova it works perfectly

hello! i’m using cordova-ios 5.1.1 and cordova-plugin-braintree (the last version available).
The old version of Braintree worked like a charm but it has the deprecated api bug, so i need to update to the latest version. I can’t make it work

Hi! How do you build your app? (Using Cordova or Capacitor).
Maybe when you will try to build it with different runtime I hope it could help you

cordova, it works fine and build the app fine: the problem is when i launch the app and try to pay with paypal., Everything works untill I access the paypal account amd choose the card and the payment method. After that, the app crashes and i get the error *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]’

Oh, understand now,
sorry I can’t here,
our issue was that because of Capacitor on iOS PayPal popup didn’t work properly