przelewy24 / p24-mobile-lib-ios

iOS library for Przelewy24 payments
2 stars 0 forks source link

App crashes when loading web view content performing a trnDirect #12

Closed AndrexOfficial closed 2 years ago

AndrexOfficial commented 2 years ago

Hello, recently the app is crashing because of a nil parameter (we can't see which one because it is protected from debug).

Here is the console crash error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff203fbbb4 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff2019ebe7 objc_exception_throw + 48
    2   Foundation                          0x00007fff208bfa51 -[NSRegularExpression(NSMatching) enumerateMatchesInString:options:range:usingBlock:] + 2180
    3   Foundation                          0x00007fff208bfcbb -[NSRegularExpression(NSMatching) firstMatchInString:options:range:] + 146
    4   P24                                 0x000000011269e6c7 +[UserAgentHelper extractWebViewVersion:] + 119
    5   P24                                 0x000000011269e606 +[UserAgentHelper userAgentNeedUpdate:minWebViewVersion:] + 62
    6   P24                                 0x000000011269e197 __37+[UserAgentHelper tryChangeUserAgent]_block_invoke + 80
    7   P24                                 0x000000011269e575 __39+[UserAgentHelper getCurrentUserAgent:]_block_invoke + 16
    8   WebKit                              0x00007fff29781d64 _ZN3WTF6Detail15CallableWrapperIZ128-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]E4$_22vJONSt12experimental15fundamentals_v38expectedINS_6RefPtrIN3API21SerializedScriptValueENS_12RawPtrTraitsIS8_EENS_21DefaultRefDerefTraitsIS8_EEEEN7WebCore16ExceptionDetailsEEEEE4callESH_ + 220
    9   WebKit                              0x00007fff298dd2d8 _ZN3WTF6Detail15CallableWrapperIZN6WebKit12WebPageProxy33runJavaScriptInFrameInScriptWorldEON7WebCore23RunJavaScriptParametersENSt3__18optionalINS_16ObjectIdentifierINS4_19FrameIdentifierTypeEEEEERN3API12ContentWorldEONS_17CompletionHandlerIFvONSt12experimental15fundamentals_v38expectedINS_6RefPtrINSD_21SerializedScriptValueENS_12RawPtrTraitsISL_EENS_21DefaultRefDerefTraitsISL_EEEENS4_16ExceptionDetailsEEEEEEE4$_21vJON3IPC14ArrayReferenceIhLm18446744073709551615EEEONS8_ISR_EEEE4callES11_S13_ + 88
    10  WebKit                              0x00007fff29bd48d1 _ZN8Messages7WebPage33RunJavaScriptInFrameInScriptWorld11cancelReplyEON3WTF17CompletionHandlerIFvON3IPC14ArrayReferenceIhLm18446744073709551615EEEONSt3__18optionalIN7WebCore16ExceptionDetailsEEEEEE + 49
    11  WebKit                              0x00007fff298dd138 _ZN3WTF6Detail15CallableWrapperIZN3IPC13MessageSender18sendWithAsyncReplyIN8Messages7WebPage33RunJavaScriptInFrameInScriptWorldEZN6WebKit12WebPageProxy33runJavaScriptInFrameInScriptWorldEON7WebCore23RunJavaScriptParametersENSt3__18optionalINS_16ObjectIdentifierINSA_19FrameIdentifierTypeEEEEERN3API12ContentWorldEONS_17CompletionHandlerIFvONSt12experimental15fundamentals_v38expectedINS_6RefPtrINSJ_21SerializedScriptValueENS_12RawPtrTraitsISR_EENS_21DefaultRefDerefTraitsISR_EEEENSA_16ExceptionDetailsEEEEEEE4$_21EEyOT_OT0_yNS_9OptionSetINS2_10SendOptionEEEEUlPNS2_7DecoderEE_vJS1C_EE4callES1C_ + 88
    12  WebKit                              0x00007fff2983c8f1 _ZN3WTF6Detail15CallableWrapperIZN6WebKit21AuxiliaryProcessProxy11sendMessageEONS_9UniqueRefIN3IPC7EncoderEEENS_9OptionSetINS5_10SendOptionEEEONSt3__18optionalINSC_4pairINS_17CompletionHandlerIFvPNS5_7DecoderEEEEyEEEENS3_35ShouldStartProcessThrottlerActivityEE3$_1vJSH_EE4callESH_ + 27
    13  WebKit                              0x00007fff298388a9 _ZN6WebKit21AuxiliaryProcessProxy22replyToPendingMessagesEv + 117
    14  WebKit                              0x00007fff298387a9 _ZN6WebKit21AuxiliaryProcessProxyD2Ev + 103
    15  WebKit                              0x00007fff29902aa7 _ZN6WebKit15WebProcessProxyD2Ev + 2097
    16  WebKit                              0x00007fff29902b86 _ZN6WebKit15WebProcessProxyD0Ev + 14
    17  WebKit                              0x00007fff2956ad33 _ZNK3WTF20ThreadSafeRefCountedIN6WebKit21AuxiliaryProcessProxyELNS_17DestructionThreadE2EE5derefEv + 67
    18  WebKit                              0x00007fff29907357 _ZN6WebKit15WebProcessProxy18didFinishLaunchingEPNS_15ProcessLauncherEN3IPC10Connection10IdentifierE + 1577
    19  WebKit                              0x00007fff29578939 _ZN6WebKit15ProcessLauncher25didFinishLaunchingProcessEiN3IPC10Connection10IdentifierE + 101
    20  WebKit                              0x00007fff29860075 _ZN3WTF6Detail15CallableWrapperIZZN6WebKit15ProcessLauncher13launchProcessEvEN3$_1clEPU24objcproto13OS_xpc_object8NSObjectEUlvE_vJEE4callEv + 133
    21  JavaScriptCore                      0x00007fff334ff58f _ZN3WTF7RunLoop11performWorkEv + 303
    22  JavaScriptCore                      0x00007fff3350057a _ZN3WTF7RunLoop11performWorkEPv + 26
    23  CoreFoundation                      0x00007fff20369e25 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    24  CoreFoundation                      0x00007fff20369d1d __CFRunLoopDoSource0 + 180
    25  CoreFoundation                      0x00007fff203691f2 __CFRunLoopDoSources0 + 242
    26  CoreFoundation                      0x00007fff20363951 __CFRunLoopRun + 875
    27  CoreFoundation                      0x00007fff20363103 CFRunLoopRunSpecific + 567
    28  Foundation                          0x00007fff2081941c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 213
    29  P24                                 0x000000011269e517 +[UserAgentHelper getCurrentUserAgent:] + 315
    30  P24                                 0x00000001126aa6ca __49-[BaseViewController setupBanks:featureCofnigId:]_block_invoke + 34
    31  Foundation                          0x00007fff2084258c __NSThreadPerformPerform + 207
    32  CoreFoundation                      0x00007fff20369e25 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    33  CoreFoundation                      0x00007fff20369d1d __CFRunLoopDoSource0 + 180
    34  CoreFoundation                      0x00007fff203691f2 __CFRunLoopDoSources0 + 242
    35  CoreFoundation                      0x00007fff20363951 __CFRunLoopRun + 875
    36  CoreFoundation                      0x00007fff20363103 CFRunLoopRunSpecific + 567
    37  GraphicsServices                    0x00007fff2c851cd3 GSEventRunModal + 139
    38  UIKitCore                           0x00007fff24ffbe63 -[UIApplication _run] + 928
    39  UIKitCore                           0x00007fff25000a53 UIApplicationMain + 101
    40  MyApp                             0x000000010d99a92a main + 58
    41  dyld                                0x00000001119a1e1e start_sim + 10
    42  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi: terminating with uncaught exception of type NSException

How can we fix it?

Thanks

mareklat commented 2 years ago

@AndrexOfficial Can you provide some steps to reproduce this issue?

AndrexOfficial commented 2 years ago

We have a button, we tap on our "Pay now" button and the P24 web view presents modally and shows a loader, after a few seconds it crashes with this kind of error

mareklat commented 2 years ago

What method of the library are you calling? Can you show code snippet?

AndrexOfficial commented 2 years ago

Hello Marek, I also tried on your example project and I get the same error and crash, You can reproduce it by tapping on "Transfer trnDirect" button no matter if Sandbox or Live env.

Tell me where I can send the project somewhere not public in order to protect our config info.

Best regards

mareklat commented 2 years ago

I repeated these steps and the mentioned error did not occur to me. Maybe it's an environmental issue. You can send your example to the following address: support@przelewy24@.pl. Please mention your conversation with me. Let them forward my e-mail to you

AndrexOfficial commented 2 years ago

Hello Marek, I've sent the email with the example project.

Case number: 2021121077014958

Let me know Best regards

mareklat commented 2 years ago

@AndrexOfficial I used your example and there was no error. This error seems quite strange. Do you have any proxy settings changed? What device did you test on?

https://user-images.githubusercontent.com/5943334/145827648-00e55528-161b-4a78-9aa4-9269714f91a0.mov

AndrexOfficial commented 2 years ago

Hello Marek, I tested it with iPhone 13 Pro (simulator) on Xcode (Version 13.1 (13A1030d)) and I'm able to reproduce this bug.

Best regards

mareklat commented 2 years ago

@AndrexOfficial Please try new library version 3.5.34. We do some small changes, this should help with your problem.

AndrexOfficial commented 2 years ago

Hello Marek, I tried with the new version and seems to work good without any kind of crash.

Thanks Best regards