Swift: XPC connection interrupted and app freezes?

只愿长相守 提交于 2021-02-16 13:26:07

问题


Ok, have no idea what is going on here but from what I understand from other questions (XPC connection interrupted in Xcode 7 for iOS 9) , XPC connection interrupted means theres a storyboard problem. Per a similar answer I opened the storyboard as source code and looked for repeated

<keycommand>

tags, but there aren't any. I had to copy and paste a storyboard from another project since something changed, and I believe this caused it. What are my options here? What could be causing this freeze since there aren't any weird tags that I can see?


回答1:


Same problem, getting the XPC error when tapping in a (SwiftUI) Text Field. Different solution:

Simulator > Device > Erase All Content and Settings

As described here,

The problem came from the keyboard that wasn't showing up. And I am not really sure why, I probably pressed a command that disables it.

To get it to work I have restarted the simulator. In the simulator menu, Hardware > Erase All Content And Settings

Now when I tap in a UITextField, the keyboard shows up and I don't get the "XPC connection interrupted" error anymore. Everything works fine.

This error was incredibly frustrating because there is no crash report, just a one-line "XPC connection interrupted" and the app freezes. And, to complicate things, it's apparently possible to get this error from some wildly differing causes -- various discussions have cases of VPN's, Bluetooth, and threading generating this. And of course -- Murphy's law -- I started getting the error after having implemented something utterly unrelated, but which has me troubleshooting threading & Core Data issues, all to no avail.

Hopefully this can help somebody else with the quick fix.




回答2:


The problem for me was that there are two storyboards, the main storyboard and the launchScreen storyboard. If you go to the top left of Xcode and click on the Xcode file, it will bring you to a screen about the file. You then scroll to deployment info and switch the main interface to whichever storyboard you use. I think that since you copied and pasted the code is not linked up to the storyboard.



来源:https://stackoverflow.com/questions/50557529/swift-xpc-connection-interrupted-and-app-freezes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!