The QQ SDK initialization method is stuck

After upgrading to Xcode11, I found that the emulator often appears “suspended animation”, neither crashes nor responds, code does not execute later, and the emulator itself can return to the desktop by pressing the Home button. After the initialization method of THE QQ SDK is executed, the code will not be executed later. If you comment out this sentence, the program will run normally. _tencentOAuth = [[TencentOAuth alloc] initWithAppId:platformModel.appID andDelegate:(id

)self];

At first, I thought it was the QQ SDK that needed to be updated for iOS13, but I still found this problem after downloading the latest version of QQ SDK. Is it related to the system version? After testing, it was found that there was no problem with the real machine, and the simulator iOS12 and iOS13 would have problems. I found that only restarting the emulator or resetting the emulator could solve this problem, but running for a while would cause this problem to occur again and restarting the emulator often was not a permanent solution.

The real culprit: Clipboard synchronization

At first, I always thought that there was something wrong with the QQ SDK code. Later, I accidentally found that the simulator would also freeze when executing the following code. [UIPasteboard generalPasteboard].string = str; Is it possible to freeze just by calling the clipboard-related API? Since the QQ SDK needs to communicate across apps, it is likely to use clipboard internally (I later confirmed this by testing the symbol breakpoint: the QQ SDK initialization method does call clipboard-related API internally).

Searched on the net, as expected there is relevant information! What’s New in Xcode 11 is mentioned in the emulator section of the article

Fixed an issue where the emulator could crash or be unresponsive after clipboard-related operations in other applications if automatic stickboard synchronization was enabled.

I’m using Xcode11.1 and it says it’s fixed, but it still exists in practice. But at least this article confirms my suspicions.

Xcode 11 iOS 13 Simulator Freeze UITextField

The solution

Turn off clipboard synchronization in the emulator and restart the emulator. Simulator -> Edit -> Automatically Sync Pasteboard deselected

Restart simulator Hardware -> Restart

This should be a bug in apple (Xcode11.1), hope apple dad fixes it soon.

If you found this article helpful, please give it a thumbs up. If you have any questions you can follow my public number to leave a message to me. Please indicate the source of reprint, thank you!