Why does the application crash when the user starts it, but does not use xcode to open it?
The iPhone system uses a watchdog timer when the program starts. Once it finds that the program takes too long to initialize the Startup Program, the system will terminate the program. The Program terminated Exception Code is 0x8badf00d, and a crash report is output.
Exception Type: 00000020
Exception Codes: 0x8badf00d
Highlighted Thread: 0
Application Specific Information:
Com. yourcompany. yourapp failed to launch in time
Elapsed total CPU time (seconds): 11.120 (user 1.840, system 9.280), 59% CPU
Elapsed application CPU time (seconds): 2.160, 12% CPU
When xcode starts the program, the watchdog timer will expire because xcode fails to attach to the debugger, causing you to fail to notice the long start time.
Of course, the simulator configuration is relatively high and may not cause any problems.
You should minimize the startup time of the application. If some things must be completed at startup, you should use the sub-thread and have a good interface prompt.
I personally suggest that you should not initialize the network response in init because of network uncertainty. If the network does not return or exceeds the time limit, the program will also be terminated.
It is unwise to perform network operations in sub-threads at the same time.
Refer:
Https://developer.apple.com/devcenter/ios/index.action