Synerise / synerise-ios-sdk

Synerise SDK for iOS
Apache License 2.0
0 stars 0 forks source link

SDK Crashed an App on Simulator #4

Closed lukasz-szyszkowski closed 1 month ago

lukasz-szyszkowski commented 1 month ago

It looks like there is a bug in SDK that crashes an application. It occurs in 100% cases. Tested on SDK 4.17.0 and 4.18.0 device: Simulator iPhone SE iOS 16.0 It works properly on Simulator iPhone 15 pro iOS 17.2

So I assume that iOS version is a clue ;)

CleanShot 2024-07-05 at 08 24 42@2x

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Provided Locale object has invalid currency code. Please ensure that provided locale is valid Locale object'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000018040c304 __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x000000018005131c objc_exception_throw + 56
    2   CoreFoundation                      0x000000018040c214 -[NSException initWithCoder:] + 0
    3   SyneriseSDK                         0x0000000105eafe0c SNR_StringToTokenOrigin + 8608
    4   SyneriseSDK                         0x0000000105eafd44 SNR_StringToTokenOrigin + 8408
    5   Development ***** iOS App           0x000000010112f750 $sSo12SNRUnitPriceC6amountABSf_tcfcTO + 24
    6   Development ***** iOS App           0x000000010112c758 $sSo12SNRUnitPriceC6amountABSf_tcfC + 44
    7   Development ***** iOS App           0x000000010112c5f0 $s25Development_*****_iOS_App14SyneriseHelperC14trackAddToCart7product8quantityyAA19ProductDetailsModelV_SitF + 180
    8   Development ***** iOS App           0x000000010105d0f4 $s25Development_*****_iOS_App16ProductViewModelC9addToCartyyYaFTY2_ + 376
    9   Development ***** iOS App           0x0000000101413b39 $s25Development_*****_iOS_App13ProductScreenV16addToCartSection33_E8BBCE08007D9E456760FC5454AE8C45LLQryF7SwiftUI9TupleViewVyAF0U0PAFE12onTapGesture5count7performQrSi_yyctFQOyAjFE2idyQrqd__SHRd__lFQOyAjFE7paddingyQrAF4EdgeO3SetV_12CoreGraphics7CGFloatVSgtFQOyAjFE5frame5width6height9alignmentQrAW_AwF9AlignmentVtFQOyAA08QuantityU0V_Qo__Qo__SiQo__Qo_Sg_AjFE12contentShape_6eoFillQrqd___SbtAF5ShapeRd__lFQOyAjFEAOyQrAS_AWtFQOyAjFEAOyQrAS_AWtFQOyAjFE12cornerRadius_11antialiasedQrAV_SbtFQOyAjFE10background_A_Qrqd___A1_tAfIRd__lFQOyAjFEAxyZA_QrAW_AWA1_tFQOyAjFEAX8minWidth10idealWidth8maxWidth9minHeight11idealHeight9maxHeightA_QrAW_A5WA1_tFQOyAF6ButtonVyAF19_ConditionalContentVyAA014CircularLoaderU0VAF6HStackVyAHyAjFE4tintyQrAF5ColorVSgFQOyAF5ImageV_Qo__AF4TextVtGGGG_Qo__Qo__A32_Qo__Qo__Qo__Qo__AF9RectangleVQo_tGyXEfU_yycfU0_yyYaYbcfU_TQ1_ + 1
    10  Development ***** iOS App           0x000000010142c9c5 $s25Development_*****_iOS_App13ProductScreenV16addToCartSection33_E8BBCE08007D9E456760FC5454AE8C45LLQryF7SwiftUI9TupleViewVyAF0U0PAFE12onTapGesture5count7performQrSi_yyctFQOyAjFE2idyQrqd__SHRd__lFQOyAjFE7paddingyQrAF4EdgeO3SetV_12CoreGraphics7CGFloatVSgtFQOyAjFE5frame5width6height9alignmentQrAW_AwF9AlignmentVtFQOyAA08QuantityU0V_Qo__Qo__SiQo__Qo_Sg_AjFE12contentShape_6eoFillQrqd___SbtAF5ShapeRd__lFQOyAjFEAOyQrAS_AWtFQOyAjFEAOyQrAS_AWtFQOyAjFE12cornerRadius_11antialiasedQrAV_SbtFQOyAjFE10background_A_Qrqd___A1_tAfIRd__lFQOyAjFEAxyZA_QrAW_AWA1_tFQOyAjFEAX8minWidth10idealWidth8maxWidth9minHeight11idealHeight9maxHeightA_QrAW_A5WA1_tFQOyAF6ButtonVyAF19_ConditionalContentVyAA014CircularLoaderU0VAF6HStackVyAHyAjFE4tintyQrAF5ColorVSgFQOyAF5ImageV_Qo__AF4TextVtGGGG_Qo__Qo__A32_Qo__Qo__Qo__Qo__AF9RectangleVQo_tGyXEfU_yycfU0_yyYaYbcfU_TATQ0_ + 1
    11  Development ***** iOS App           0x0000000100d8a34d $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRTQ0_ + 1
    12  Development ***** iOS App           0x0000000100d8a4a9 $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRTATQ0_ + 1
    13  libswift_Concurrency.dylib          0x00000001ae384d0d _ZL23completeTaskWithClosurePN5swift12AsyncContextEPNS_10SwiftErrorE + 1
)
libc++abi: terminating with uncaught exception of type NSException
awoczek commented 1 month ago

Hello @lukasz-szyszkowski, could you check your language and region settings on simulator? That exception is thrown when NSLocale.current returns nil. This case is propably only occuring on iOS Simulator in concrete setup or when iOS Simulator is not configured properly in this section.

Did you try reset iOS Simulator or run on other iOS Simulator instance?

awoczek commented 1 month ago

@lukasz-szyszkowski

  1. Check please on your simulator [[NSLocale currentLocale] objectForKey:NSLocaleCurrencyCode]; returns. Depending to your iOS on simulator it should return correct locale settings.

  2. You could use the second method for UnitPrice object construct - init(amount:locale:)

  3. We think about exception in this method in future releases.

Now, I am closing the issue for now.