我正在开发一个 iOS 应用程序,它在 Xcode 11.7 上运行良好,但是当我在 Xcode 12 中运行相同的代码并且当我进入 UIPageViewController 时,应用程序运行到无限循环并且 cpu 使用率显示为 99%。这是我在调试器中暂停应用程序后制作的屏幕截图。
它通过导致 UIApplicationMain() 返回来显示应用程序违反契约(Contract)。将报告此事件。
最佳答案
我在 Xcode 12 中遇到过类似的崩溃。
我通过从我的 View 中删除自定义加载微调器来解决它们,这似乎造成了这些问题。加载微调器看起来像这样(也许您在应用程序中使用了类似的动画代码?):
struct Spinner: View {
@State private var isSpinning = false
var body: some View {
Circle()
.trim(from: 1/5, to: 1)
.stroke(style: StrokeStyle(lineWidth: 2, lineCap: .round, lineJoin: .round))
.rotationEffect(.degrees(isSpinning ? 360 : 0))
.animation(Animation.linear(duration: 1).repeatForever(autoreverses: false))
.onAppear() {
self.isSpinning = true
}
}
}
关于ios - Xcode 12 GM 陷入无限循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63923741/