App crash on iOS devices after clicking on (non-empty)editable text


I created a basic app with UE4_26 for iOS with a widget and I’m getting a crash after clicking on an Editable Text which already has some text in it. Sometimes it only crashes after 2nd/3rd/4th time, but the crash is consistent.
I tried this with iPhone 7 Plus and iPad Air(3rd Gen).

Steps to reproduce:

  1. Create an empty project
  2. Create a Widget
  3. Add either an Editable text or Multi line Editable text to the widget
  4. Add the Widget to the viewport
  5. Launch the project on an iOS device
  6. Click on the Editable Text and type some letter.
  7. Click “OK” button to confirm your input
  8. Repeat the previous 2 steps a few times( after 2nd or 3rd repeat, the app should crash)

Can anyone confirm this behaviour?

I ran in to this lately. I am using 4.26 build from source. I was able to fix it by changing the engine code. They create an Objective-C object for the text field, and in it they store the text and the hint in cached NSStrings, using [NSString copy] to copy the value, however [NSString copy] might pass a reference to the original NSString so when they call [NSString release] on the cached string they may be deleting the original, depending on whether IOS feels like allocating a new string for the cached string or not. It then goes and tries to set itself to the deleted value which causes the crash. Its possible this has been a bug for a long time. I fixed it by changing the declaration of the cache strings to NSMutableString and removing the release and using [NSMutableString setString:val] instead of copy. You may not be using the source build, so you have to wait for Epic to fix this. I’ll see if I can issue a bug report for them.

\Engine\Source\Runtime\Slate\Public\Framework\Text\IOS\IOSPlatformTextField.h starting at line 33

@interface SlateTextField : UIAlertController
TWeakPtr<IVirtualKeyboardEntry> TextWidget;
FText TextEntry;

bool bTransitioning;
bool bWantsToShow;
//- NSString* CachedTextContents;
//- NSString* CachedPlaceholderContents;
NSMutableString* CachedTextContents; //+
NSMutableString* CachedPlaceholderContents; //+

\Engine\Source\Runtime\Slate\Private\Framework\Text\IOS\IOSPlatformTextField.cpp starting at line 186

-(void)show:(TSharedPtr<IVirtualKeyboardEntry>)InTextWidget text:(NSString*)TextContents placeholder:(NSString*)PlaceholderContents keyboardConfig:(FKeyboardConfig)KeyboardConfig
TextWidget = InTextWidget;
TextEntry = FText::FromString(TEXT(""));
//- if(CachedTextContents != nil)
//- {
//- [CachedTextContents release];
//- }
//- if(CachedPlaceholderContents != nil)
//- {
//- [CachedPlaceholderContents release];
//- }

[CachedTextContents setString : TextContents] ; //+
[CachedPlaceholderContents setString : PlaceholderContents] ; //+
//- CachedTextContents = [TextContents copy]; // This is the line that throws the error 
//- CachedPlaceholderContents = [PlaceholderContents copy];
CachedKeyboardConfig = KeyboardConfig;
bWantsToShow = true;

and starting at line 144

bWantsToShow = false;
if(CachedTextContents != nil)
//- [CachedTextContents release];
CachedTextContents = nil;
if(CachedPlaceholderContents != nil)
//- [CachedPlaceholderContents release];
CachedPlaceholderContents = nil;


Thanks tomotor, I really appreciate your response. I’m not using a source build at the moment, so could you please submit a bug report?
I also created a bug months ago, but they haven’t replied yet. Maybe if you explain the details it will be fixed sooner.

I had the same issue, and the “use integrated keyboard” in the setting fixed it for me.

1 Like


Thanks tomotor! Your answer is very helpful!

Thanks @tomotor this is works for me, but meantime, i met another problems, which is something about “couldn’t find file for package/Game/Blueprints/BP_AccountSaved… requested by async loading code” , then on the device ipad pro(11-inch), can’t really use the function save username and password, do you have any hints about this?