omise / omise-ios

Omise iOS SDK
https://www.opn.ooo
MIT License
74 stars 36 forks source link

OMSAuthorizingPaymentViewController NSInvalidArgumentException #143

Closed luyud closed 3 years ago

luyud commented 3 years ago

Since the past year, our production environment has reported several crashes

*** -[__NSCFString stringByReplacingCharactersInRange:withString:]: nil argument

And page tracking shows that the last few pages are

...
13 07-12 16:51:09.627 [ UISystemKeyboardDockController ] WillAppear
14 07-12 16:51:16.630 [ OMSAuthorizingPaymentViewController ] WillAppear
15 07-12 16:51:20.999 [ UISystemKeyboardDockController ] WillAppear
16 07-12 16:51:21.003 [ UICompatibilityInputViewController ] WillAppear
17 07-12 16:51:21.003 [ UICompatibilityInputViewController ] WillAppear
18 07-12 16:51:21.005 [ UICompatibilityInputViewController ] WillAppear
...

I found that OMSAuthorizingPaymentViewController is just a webView. Any suggestions on this problem? Thanks.

nuxzero commented 3 years ago

Thank you for raising this issue. Could you provide more information (e.g. iOS version, sample code) that we can investigate about this?

luyud commented 3 years ago

Sorry, I forgot to say that this only happens when using “TrueMoney” payment.

The iOS version does not seem to point to a specific version,the last few versions are 14.6, 14.3

We use API to create payment request, than use authorize_uri,return_uri in response to show OMSAuthorizingPaymentViewController

    UINavigationController *omsAuthNav = [OMSAuthorizingPaymentViewController authorizingPaymentViewControllerNavigationWithAuthorizedURL:url expectedReturnURLPatterns:returnUrl delegate:self];
    omsAuthNav.modalPresentationStyle = UIModalPresentationOverFullScreen;
    [self presentViewController:omsAuthNav animated:YES completion:nil];

stringByReplacingCharactersInRange method is not used in my code, which is strange.

nuxzero commented 3 years ago

I have tested on the latest version, I have not seen any errors. And in the Omise iOS there’s no stringByReplacingCharactersInRange method that has been used. Could you try on the latest version (v.4.4.0)? If the issue still persists please provide a sample project that contains this issue.

luyud commented 3 years ago

In fact, I can’t reproduce this crash, but it keeps appearing in the crash report even though the probability is very small.

I close this issue now, and I will reply if there are any new discoveries, thank you.

nuxzero commented 3 years ago

You're welcome. Please don't be hesitate to re-open if you found any issues. 🙂