danielsogl / awesome-cordova-plugins

Native features for mobile apps built with Cordova/PhoneGap and open web technologies. Complete with TypeScript support.
https://danielsogl.gitbook.io/awesome-cordova-plugins/
Other
2.41k stars 2.42k forks source link

Ionic 4 / 5, Cordova >= 8 & iOS - the app crashes #3382

Closed ciccilleju closed 4 years ago

ciccilleju commented 4 years ago

[ x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/

Current behavior:

Since Apple no longer accepts UiWebview based libraries the braintree-plugin's version on Ionic Page doesn't work anymore on iOS (works fine on Android). So I tried to update with other mantained forks but they aren't working on iOS becasue, with the previous version (on Ionic page) i never had to edit the code on XCode, i just had to set the urlscheme. Now with the update fork i've found, to set the url scheme, I need to update the AppDelegate file, but doing this will make the app crash.

Related code:

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

Other information: