首页 > 解决方案 > 线程 1:信号 SIGABRT 因为 NavigationView -> List -> Section 中的按钮

问题描述

从 Xcode 12 开始,我有一个Thread 1: signal SIGABRT,这里是错误的详细信息:

2020-10-20 00:01:20.989409+0200 App[23604:1417143] 前置条件失败:导入的节点在读取其值之前被删除:90

当我快速更改选项卡时会出现崩溃。

我认为崩溃来自 ReSwift,但经过调查,当我评论按钮时,崩溃消失了(我试图只评论调度,但应用程序仍然崩溃)。这是代码:

struct Profile: View {
    @ObservedObject private var state = ObservableState(store: appStore)
    
    var genderOptions = ["‍♂️ Male", "‍♀️ Female", " Other"]
    
    var body: some View {
        NavigationView {
            List {
                Section(header: Text("Manage account")) {
                    NavigationLink(destination: ChangePassword()) {
                        Text("Change password")
                            .foregroundColor(.blue)
                    }
                    Button(action: {
                        self.state.dispatch(signOut(state: self.state.current, store: appStore))
                    }) {
                        Text("Deconexion")
                    }
                    NavigationLink(destination: DeleteAccount()) {
                        Text("Delete account")
                            .foregroundColor(.red)
                        
                    }
                }
            }
            .font(.system(size: 17))
            .listStyle(GroupedListStyle())
            .environment(\.horizontalSizeClass, .regular)
            .navigationBarTitle(Text((self.state.current.firebaseAuthState.userDetail?.firstName)!))
        }
    }
}

我不明白为什么这个按钮会引发这样的崩溃。

先感谢您。

标签: swiftxcodeswiftuireswift

解决方案


推荐阅读