Profiling UITest case always terminates in the middle of testing, which never occurs during normal testing?

In my iOS project, there is an infrequent crash related to virtual memory problem. Therefore, I plan to use UITest in combination with Product/Perform Action/Profile "TestCaseName" to conduct Game Performance-type testing. This allows the automatic testing to continuously operate until the profile stops recording upon a crash. This enables me to observe the various states of the program at the time of the crash.

However, I have found that the UITest using Profile is highly unstable. The UITestCase often terminates unexpectedly during execution, leading to failed tests (Instruments is still working). Sometimes, the app is terminated immediately after startup. It seems that the use of sleep() in the code can easily cause interruption issues, which do not occur during normal UI testing.

I am wondering if anyone has experience using Profile for UITest and whether they have encountered the issues I described."

Working Environment: XCode14.3.1, iPhone Device iOS17.2

Profiling UITest case always terminates in the middle of testing, which never occurs during normal testing?
 
 
Q