Ionic 3 IOS application crash when click on paypal

2019-09-22 18:16发布

问题:

step 1

step 2

This is the error I am getting on clicking paypal button

error

this app is working fine on Android. But crashing on IOS. Build by IONIC 3. How to solve this issue ? The rent button will redirect to the PayPal. Using PayPal Sandbox account. please help. thanks

2018-05-21 13:04:03.754557+0530 thegrand[665:8151] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/krishanu_mukherjee/Library/Developer/CoreSimulator/Devices/67065A2C-5E45-47EB-AAD8-5F2E8D5149F4/data/Containers/Data/Application/13D49686-3CB1-4CC3-9967-772BBC693FFA/Library/Cookies/io.ionic.starter.binarycookies 2018-05-21 13:04:04.026035+0530 thegrand[665:8151] Apache Cordova native platform version 4.5.3 is starting. 2018-05-21 13:04:04.028647+0530 thegrand[665:8151] Multi-tasking -> Device: YES, App: YES 2018-05-21 13:04:04.118347+0530 thegrand[665:8151] CDVWKWebViewEngine: trying to inject XHR polyfill 2018-05-21 13:04:04.468109+0530 thegrand[665:8151] CDVWKWebViewEngine will reload WKWebView if required on resume 2018-05-21 13:04:04.468371+0530 thegrand[665:8151] Using Ionic WKWebView 2018-05-21 13:04:04.470572+0530 thegrand[665:8151] [CDVTimer][console] 0.168085ms 2018-05-21 13:04:04.470968+0530 thegrand[665:8151] [CDVTimer][handleopenurl] 0.163078ms 2018-05-21 13:04:04.474148+0530 thegrand[665:8151] [CDVTimer][intentandnavigationfilter] 3.002048ms 2018-05-21 13:04:04.474516+0530 thegrand[665:8151] [CDVTimer][gesturehandler] 0.118971ms 2018-05-21 13:04:04.474793+0530 thegrand[665:8151] [CDVTimer][paypalmobile] 0.108004ms 2018-05-21 13:04:04.475352+0530 thegrand[665:8151] CDVIonicKeyboard: resize mode 1 2018-05-21 13:04:04.476834+0530 thegrand[665:8151] [CDVTimer][keyboard] 1.547933ms 2018-05-21 13:04:04.533597+0530 thegrand[665:8151] [CDVTimer][splashscreen] 56.516051ms 2018-05-21 13:04:04.533796+0530 thegrand[665:8151] [CDVTimer][TotalPluginStartup] 63.489914ms 2018-05-21 13:04:12.591638+0530 thegrand[665:8151] Angular is running in the development mode. Call enableProdMode() to enable the production mode. 2018-05-21 13:04:12.592087+0530 thegrand[665:8151] deviceready has not fired after 5 seconds. 2018-05-21 13:04:12.592766+0530 thegrand[665:8151] Channel not fired: onDOMContentLoaded 2018-05-21 13:04:12.593073+0530 thegrand[665:8151] Ionic Native: deviceready event fired after 4048 ms 2018-05-21 13:04:12.896733+0530 thegrand[665:8151] WARN: Native: tried calling StatusBar.styleDefault, but the StatusBar plugin is not installed. 2018-05-21 13:04:12.897143+0530 thegrand[665:8151] WARN: Install the StatusBar plugin: 'ionic cordova plugin add cordova-plugin-statusbar' 2018-05-21 13:04:13.135458+0530 thegrand[665:8151] CDVWKWebViewEngine: handleStopScroll 2018-05-21 13:04:13.172548+0530 thegrand[665:8151] WARN: Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys 2018-05-21 13:04:13.407415+0530 thegrand[665:8151] ERROR: Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error 2018-05-21 13:04:20.262243+0530 thegrand[665:8151] CDVWKWebViewEngine: handleStopScroll 2018-05-21 13:04:23.648832+0530 thegrand[665:8151] CDVWKWebViewEngine: handleStopScroll 2018-05-21 13:04:27.249545+0530 thegrand[665:8151] CDVWKWebViewEngine: handleStopScroll 2018-05-21 13:04:30.888592+0530 thegrand[665:8151] CDVWKWebViewEngine: handleStopScroll 2018-05-21 13:04:32.490485+0530 thegrand[665:8151] 1 0 2018-05-21 13:04:32.856165+0530 thegrand[665:8923] A location manager (0x7fbb58f11990) was created on a dispatch queue executing on a thread other than the main thread. It is the developer's responsibility to ensure that there is a run loop running on the thread on which the location manager object is allocated. In particular, creating location managers in arbitrary dispatch queues (not attached to the main queue) is not supported and will result in callbacks not being received. 2018-05-21 13:04:32.971875+0530 thegrand[665:8924] -[NSCFNumber length]: unrecognized selector sent to instance 0xb0000000000000c5 2018-05-21 13:04:32.978500+0530 thegrand[665:8924] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0xb0000000000000c5' *** First throw call stack: ( 0 CoreFoundation 0x0000000108eb71e6 __exceptionPreprocess + 294 1 libobjc.A.dylib 0x000000010851e031 objc_exception_throw + 48 2 CoreFoundation 0x0000000108f38784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x0000000108e39898 ___forwarding_ + 1432 4 CoreFoundation 0x0000000108e39278 _CF_forwarding_prep_0 + 120 5 Foundation 0x00000001042cba3c -[NSScanner(NSDecimalNumberScanning) scanDecimal:] + 303 6 Foundation 0x0000000104355f41 -[NSDecimalNumberPlaceholder initWithString:locale:] + 127 7 Foundation 0x00000001043561de +[NSDecimalNumber decimalNumberWithString:] + 46 8 thegrand 0x0000000102fb0535 __51-[PayPalMobileCordovaPlugin renderSinglePaymentUI:]_block_invoke + 1013 9 libdispatch.dylib 0x000000010a721807 _dispatch_call_block_and_release + 12 10 libdispatch.dylib 0x000000010a722848 _dispatch_client_callout + 8 11 libdispatch.dylib 0x000000010a727675 _dispatch_queue_override_invoke + 1451 12 libdispatch.dylib 0x000000010a72e3c8 _dispatch_root_queue_drain + 664 13 libdispatch.dylib 0x000000010a72e0d2 _dispatch_worker_thread3 + 132 14 libsystem_pthread.dylib 0x000000010ac4c1ca _pthread_wqthread + 1387 15 libsystem_pthread.dylib 0x000000010ac4bc4d start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException

回答1:

I guess you are using ionic native paypal plugin you will find the line

this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
    // Only needed if you get an "Internal Service Error" after PayPal login!
    //payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal
})).then(() => {
    let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale');
    this.payPal.renderSinglePaymentUI(payment).then(() => {

The price will be integer like -> 3.33 not string '3.33' in case of android it will work fine but on ios it will crash the app