问题
I updated my project to Swift 5 in Xcode 11 and now the program freezes at my animation blocks in the iPhone 11 simulator. When I set a breakpoint after the animation it never hits it. Restarting Xcode and the Simulator did not solve the issue. If I run the program on a device it works fine.
Any ideas about what's going on? Maybe a memory issue?
UIView.animate(withDuration: 1, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: [UIView.AnimationOptions.curveEaseIn], animations: {
self.introTextView.transform = self.introTextView.transform.translatedBy(x: 200, y: 0)
})
回答1:
Apparently it's a bug on the Simulator. Hopefully it will be solved soon, but until then, you can fix by unchecking the pasteboard option.
Simulator -> Edit -> Automatically Sync Pasteboard.
From this helpful answer here.
回答2:
After restarting my computer everything now seems to be working fine. If that changes I will report back in case anyone else runs into the same issue.
UPDATE: Unfortunately it's a temporary fix. After a while, the simulator freeze issue starts again and I need to restart to get it working properly.
Additional UPDATE: After updating to the newest version of Xcode the issue went away.
来源:https://stackoverflow.com/questions/58194400/simulator-freezes-at-animation-blocks-after-swift-5-xcode-11-update