App relaunch fails sometimes: Failed to create bundle record for bundleID <private> and error <private>

When I try to use debug mode in Xcode, the app launches when initially started through the run command in Xcode. However, if I try to relaunch the app, it constantly fails (showing 1 second or so my splash screen before terminating). These are happening on real devices, provisioned via AppConnect.

When I try to use the app and run it in release mode, relaunching sometimes works and sometimes it does not.

Note that I am using Flutter and in the simulators, it works all great.

These are the errors I get:

domain: BSServiceConnectionErrorDomain; code: 3 ("OperationFailed"); "XPC error received on message reply handler">.

Jan  2 01:14:09 SpringBoard(FrontBoard)[33] <Error>: 
[app<com.example.myappnamehere(6DC11EF2-C3B9-459A-9210-004DA66051D2)>:2287] 
Termination failed with error: Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}

    NSUnderlyingError = <NSError: 0x2801a5e30; domain: 
BSServiceConnectionErrorDomain; code: 3 ("OperationFailed"); "XPC error received on message reply handler">;

Jan  2 01:14:10 ReportCrash(MetricKitSource)[134] 
<Error>: Failed to create bundle record for bundleID <private> and error <private>

Jan  2 01:15:56 SpringBoard(FrontBoard)[33] <Notice>: [(FBSceneManager):sceneID:com.example.myappnamehere-default][1] 
Scene invalidated with error: <NSError: 0x2801a2d30; domain: BSServiceConnectionErrorDomain; code: 3 ("OperationFailed"); "XPC error received on message reply handler">.

I noticed that sometimes I get these errors on a successful launch as well, except for this one:

ReportCrash(MetricKitSource)[131] <Error>: Failed to create bundle record for bundleID <private> and error <private>

This error is always shown when I fail to relaunch my app.

Note that I do not see any other error logs. As the situation only happens when I first manually close my app (otherwise you can't relaunch, of course), the debugger log of Xcode etc. are not showing me anything anymore.

Anyone knows what is happening here and how I can solve it?

App relaunch fails sometimes: Failed to create bundle record for bundleID &lt;private&gt; and error &lt;private&gt;
 
 
Q