Introduction: Recently, in the process of debugging the real machine, suddenly appeared in the App startup for a long time to suspend the phenomenon, each compilation will be stuck in the startup interface for nearly a minute, absolutely frustrating.

Produce phenomenon

At the beginning, a pop-up box popped up during compilation (not captured in time), which basically means: a state was opened during real machine debugging, which will increase the compilation time.

At that time also did not care too much, checked by default. Every time the compilation ran, it would be stuck in the startup interface. At first, I thought it was Crash, but it didn’t. No log was printed in the log bar, so I was confused.

After the query of relevant documents, found that there are also a lot of programs ape encountered the same problem, basically there are the following phenomena:

  • When connected to Xcode real machine debugging, after App startup, will appearStuck phenomenon, at least a few seconds, at most a few minutes, will officially enter the App interface;
  • The log bar at the bottom of Xcode will not print any logs due to the lag, so it is not enteredAppDelegateIn thedidFinishLaunchingWithOptionsMethod;
  • Project progress panel interfaceShow the Debug navigator, you will find that all values arezeroSo the App is not actually running.

Troubleshoot problems

During Xcode debugging, especially during the debugging of the real machine, we need to download the support file of the corresponding system version of the device (real machine and simulator) to ensure that Xcode can be compatible with the normal debugging of the corresponding system.

Since Xcode is a backward-compatible development tool, Xcode will automatically download the specified support files for us when the version is compatible.

The file path is as follows:

~/Library/Developer/Xcode/iOS DeviceSupport

I guess the specific cause is compatibility issues:

  • The current Xcode automatically downloaded or existing support file is not compatible with the current support file required by the real machine.

Problem solving

So when we know why, we just need to delete the corresponding support files and let Xcode download again.

Step one:

Press Command + Shift + G to enter any folder:

~/Library/Developer/Xcode/iOS DeviceSupport

Delete support files corresponding to the current real system version.

Step 2:

Access the Devices selection bar from the menu bar: Window -> Devices and Simulators;

Right-click the corresponding Device and select Unpair Device to untrust the Device.

When the device connects to Xcode again, the trust is re-added, and the support files required by the current device are automatically downloaded, and the device is compiled again.

conclusion

Record it here for daily study.

Refer to the link

  • Xcode update DeviceSupport file after real machine debugging hang at App startup
  • Xcode real machine debugging is too slow

Copyright statement

Alfalfa Ghost Xian (Alfalfa, Jijiucheng)

[iOS] Xcode real machine debugging App starts to hang for a long time

Publish Date: 2022/04/11 18:00:00

Last update at: 2022/04/11 18:00:00

GitHub: Github-Jijiucheng

Personal blog: GitHub. IO – Alfalfa ghost fairy

Little column: Little column – Alfalfa ghost fairy

Nuggets: Nuggets – Alfalfa ghost fairy

Weibo: Weibo – Alfalfa Ghost Fairy

Public account: Wechat – Alfalfa Station

Small program: Wechat – Alfalfa station