Search Issue Tracker

Fixed

Fixed in 6000.0.27f1, 6000.1.0a4, 7000.0.0a10

Votes

0

Found in

2021.3.42f1

2022.3.42f1

6000.0.15f1

7000.0.0a1

Issue ID

UUM-78397

Regression

No

[iOS] Crash on libsystem_platform.dylib`_platform_strlen when Hide Mobile Input is toggled and inputting emoji characters

--

-

How to reproduce:
1. Open the attached Project "EmojiErrorExample.zip"
2. Build and Run the Scene "SampleScene" on iOS
3. Select the Input Field "Without mobile input"
4. Enter emoji characters into the Input Field
5. Move the Caret between 2 emojis
6. Continue adding emojis

Reproducible with: 2021.3.42f1, 2022.3.42f1, 6000.0.15f1

Reproduced on:
- iPhone 7 Plus (iOS 14.6)

First lines of the Stack Trace:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x00000001eb845724 libsystem_platform.dylib`_platform_strlen + 4
frame #1: 0x000000010323e2ac UnityFramework`CreateCppStringFromNSString(NSString*) + 84
frame #2: 0x0000000103241660 UnityFramework`KeyboardOnScreen::GetText() const + 40
frame #3: 0x000000010274c508 UnityFramework`TouchScreenKeyboard_Get_Custom_PropText(void*, BindingsManagedSpan*) + 80

Notes:
- Not reproducible on Android
- The issue sometimes requires multiple emoji inputs to crash
- Another issue that can be observed is the Caret position being incorrect when attempting to move it after adding emojis, the offset increases with more emojis being added

  1. Resolution Note (fix version 7000.0.0a10):

    Fixed issue with emojis in TextField on mobile.

  2. Resolution Note (fix version 6000.1.0a4):

    Fixed issue with emojis in TextField on mobile.

  3. Resolution Note (fix version 6000.0.27f1):

    Fixed issue with emojis in TextField on mobile.

Comments (1)

  1. nadav-kooply

    Aug 26, 2024 06:34

    I believe I found a fix for this issue. In TMP_InputField.cs you need to change the following lines in UpdateKeyboardStringPosition method:

    From:
    var selectionStart = Mathf.Min(caretSelectPositionInternal, caretPositionInternal);
    var selectionLength = Mathf.Abs(caretSelectPositionInternal - caretPositionInternal);

    To:
    var selectionStart = Mathf.Min(stringSelectPositionInternal, stringPositionInternal);
    var selectionLength = Mathf.Abs(stringSelectPositionInternal - stringPositionInternal);

    This seems to fix the issue.
    It also looks related to a similar issue with emojis on android:
    https://issuetracker.unity3d.com/issues/android-writing-text-or-adding-more-emojis-after-an-emoji-in-the-inputfield-causes-the-first-emoji-to-disappear-and-be-changed-to-two-question-marks-when-hide-mobile-input-is-enabled-on-some-android-devices

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.