1

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)>
frank61003
  • 205
  • 3
  • 16
  • 1
    Please edit your question to include the error message in the body of the question, and tag it with the relevant language. – miken32 Jan 20 '20 at 19:02
  • 1
    Thanks for your comment. I have edited my question. – frank61003 Jan 21 '20 at 03:16
  • Well, as I see from demo it is combination of `NavigationView` & `TabView`, which are not designed to live within each other (please see similar in topic [Hide TabBar when a new view is pushed in SwiftUI](https://stackoverflow.com/a/59016082/12299030)). However there is approach to avoid this by separating those two containers in view stack and synchronise them programmatically when needed as in topic [SwiftUI, setting title to child views of TabView inside of NavigationView does not work](https://stackoverflow.com/a/59560140/12299030) – Asperi Jan 21 '20 at 06:15

0 Answers0