I am betting that your release mode includes compiling with your distribution certificate, which disallows this behavior (you wouldn't want some random fool hooking into your app after downloading it from the app store). Compile with the development certificate instead. You can change this in the building settings under code signing.
遇到的问题:我想在真机上调试代码。但是报错提示:process launch failed: failed to get the task for process 28107
错误原因就是上面英文说的: