In fact, you can use a macro like #if_debug to insert a debug-specific version of the code without deleting it.
Secondly, in the debug version, xcode will insert some debugging-specific codes to simulate the test environment, but the release version will remove these codes for performance, which sometimes leads to inconsistent running results. If the code is written incorrectly, the release version may crash, so it is still necessary to test the release code specially.