ios - Xcode 12 GM 陷入无限循环

标签 ios xcode12

我正在开发一个 iOS 应用程序,它在 Xcode 11.7 上运行良好,但是当我在 Xcode 12 中运行相同的代码并且当我进入 UIPageViewController 时,应用程序运行到无限循环并且 cpu 使用率显示为 99%。这是我在调试器中暂停应用程序后制作的屏幕截图。
enter image description here
它通过导致 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/

相关文章:

ios - 为什么触发 unwind segue 的按钮会立即消失?

ios - 是否可以将谷歌日历添加到 iOS 应用程序?

ios - UIActivityViewController => LaunchServices : invalidationHandler called

swift - iOS 14上的TableView中会出现一个额外的UITableViewCellContentView叠加层,可防止点击,但在iOS 13上可以正常工作

ios - 模块未在库演化支持下编译;使用它意味着无法保证二进制兼容性

swift - Xcode 12 和 iOS 14 中的手势问题

ios - 将 UILabel 作为 subview 添加到 UITextView 时存在不明确的约束

iphone - 在后台线程中运行方法后应用程序崩溃

SwiftUI 2.0 : export images with . 文件导出器修饰符

ios - Xcode 12 - 没有要编译的架构(ONLY_ACTIVE_ARCH=YES,active arch=x86_64,VALID_ARCHS=arm64e armv7s arm64 arm7)