Search Unity

Crash on iOS in AppleValidator.Validate with Arabic culture.

Discussion in 'Unity IAP' started by mradel, Apr 29, 2020.

  1. mradel

    mradel

    Joined:
    Jan 16, 2018
    Posts:
    10
    We found the following crash in receipt validation AppleValidator.Validate when the device is set to a specific language
    (culture is ar-SA in this case).

    Purchasing version: [1.23.1]
    iOS with language set to Arabic
    With a subscription receipt to validate

    It seems to be an issue with non-invariant culture in parsing.
    We used the following work around for this:

    Code (CSharp):
    1. CultureInfo culture = Thread.CurrentThread.CurrentCulture;
    2. try {
    3.     Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
    4.     appleReceipt = m_Validator.Validate(receiptBytes);
    5. } catch (System.Exception e) {
    6.     // other error...
    7. } finally {
    8.     if (culture != null) {
    9.         Thread.CurrentThread.CurrentCulture = culture;
    10.     }
    11. }
     
  2. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    Thank you for reporting this, we will confirm it.