When I use NavigationLink
to go back, it shows the above error message. What does this error message mean? I can't find any article about this issue. When it crashed, it take me to the @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate and show this words "Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee86aafd8)".
Due to I just navigate to a simple view and still crashed when pressed back.It's fine to use tabView to another view. I think this is navigationLink issue.
Demo : https://youtu.be/g8-t0m-0xkU
After I put all my extract button code in SelectPlayerView, it can work very well.So I think is there any problem with my goToSelectStartingLineupButton...
struct SelectPlayerView: View {
@EnvironmentObject var teamResult : TeamResult
@ObservedObject var allPlayerList : PlayersGameData = PlayersGameData()
//
var body: some View {
goToSelectStartingLineupButton(allPlayerList: allPlayerList)
}.onAppear(perform: getTeamMemberResults)
.onDisappear(perform: clearTeamMemberResults)
}
struct goToSelectStartingLineupButton: View {
@ObservedObject var allPlayerList : PlayersGameData
@EnvironmentObject var teamResult: TeamResult
@State var goToNextPage : Bool = false
var selectedPlayerList : PlayersGameData = PlayersGameData()
var body: some View {
VStack (spacing: 10){
Button(action: {
self.goToNextPage.toggle()
for i in 0 ..< self.allPlayerList.playersGameDataArray.count{
if(self.allPlayerList.playersGameDataArray[i].isPlayer){
self.selectedPlayerList.playersGameDataArray.append(self.allPlayerList.playersGameDataArray[i])
}
}
}){
Image(systemName: "arrowshape.turn.up.right.circle"
Text("\(self.teamResult.groupID) name:\(self.teamResult.groupName)")
}
NavigationLink(destination: SelectStartingLineupView(selectedPlayerList:
self.selectedPlayerList).environmentObject(teamResult),isActive: $goToNextPage){
EmptyView()
}
}.animation(.spring())
}
}
The class i want to navigate to is below
struct SelectStartingLineupView: View {
@ObservedObject var selectedPlayerList : PlayersGameData
var body: some View {
VStack {
List(selectedPlayerList.playersGameDataArray){
(player) in
SelectPlayerCellView(player: player)
}
}
}
}
error message:
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6000021ea0d0 'assistantView.bottom' TUISystemInputAssistantView:0x7f865370ed40.bottom == _UIKBCompatInputView:0x7f865341fa90.top (active)>