iOS Question iTabstrip signal - 11 crash when setting pages

Sviluppatori Liceo Giovio

Member
Licensed User
I'm using a tabstrip contained within a panel which I'm removing and then re-adding. Every time the panel is added again after being removed I define the pages again, load their layouts and add them to the tabstrip.

I have tested this exact setup on a smaller project and it works fine (attached to this post). But on my main project it crashes with the following message:

B4X:
SignalHandler 11
Error occurred on line: 1758 (Main)
Signal - 11
Stack Trace: (
    "0   InfoGiovio           SignalHandler + 112",
    "1   libsystem_platform.dylib            0x1af88251 _sigtramp + 16",
    "2   UIKit                <redacted> + 66",
    "3   UIKit                <redacted> + 56",
    "4   InfoGiovio           -[XLButtonBarView moveFromIndex:toIndex:withProgressPercentage:pagerScroll:] + 140",
    "5   InfoGiovio           -[XLButtonBarPagerTabStripViewController pagerTabStripViewController:updateIndicatorFromIndex:toIndex:withProgressPercentage:indexWasChanged:] + 120",
    "6   InfoGiovio           -[B4IPagerTabStrip pagerTabStripViewController:updateIndicatorFromIndex:toIndex:withProgressPercentage:indexWasChanged:] + 80",
    "7   InfoGiovio           -[XLPagerTabStripViewController updateContent] + 1634",
    "8   InfoGiovio           -[XLPagerTabStripViewController reloadPagerTabStripView] + 730",
    "9   InfoGiovio           -[XLButtonBarPagerTabStripViewController reloadPagerTabStripView] + 62"
)
 

Attachments

Sviluppatori Liceo Giovio

Member
Licensed User
B4X:
Sub TabStripSetup
 
  

    Dim TabPages As List
    TabPages.Initialize
    Dim cs As CSBuilder
    Dim TutteP,StudentiP,GenitoriP,InsegnantiP As Page
  
    TutteP.Initialize("TutteP")
    TutteP.RootPanel.LoadLayout("Tutte")
    SetAttributedTitle(TutteP,cs.Initialize.Color(Colors.White). Append("Tutte").PopAll)
      
    TabPages.Add(TutteP)
  
    StudentiP.Initialize("StudentiP")
    StudentiP.RootPanel.LoadLayout("Studenti")
    SetAttributedTitle(StudentiP,cs.Initialize.Color(Colors.White).Append("Studenti").PopAll)

    TabPages.Add(StudentiP)
  
    GenitoriP.Initialize("GenitoriP")
    GenitoriP.RootPanel.LoadLayout("Genitori")
    SetAttributedTitle(GenitoriP,cs.Initialize.Color(Colors.White).Append("Genitori").PopAll)

    TabPages.Add(GenitoriP)
  
  
    If LoginCheck Then
  
        InsegnantiP.Initialize("InsegnantiP")
        InsegnantiP.RootPanel.LoadLayout("Insegnanti")
        SetAttributedTitle(InsegnantiP,cs.Initialize.Color(Colors.White).Append("Insegnanti").PopAll)
        TabPages.Add(InsegnantiP)
 
        InsegnantiListView.AsView.Tag = 2
        InsegnantiListView.AnimationDuration = 0
    End If
  

    TabStrip1.SetPages(TabPages)
  
    StudentiListView.AsView.Tag = 0
    GenitoriListView.AsView.Tag = 1
    TutteListView.AsView.Tag = 3
  
    TopPanel = xui.CreatePanel("")

    TopPanel.SetLayoutAnimated(0, 0, 0, MainPage.RootPanel.Width, 70dip)
  
    TopPanel.LoadLayout("top")
  
    StudentiListView.AnimationDuration = 0
    GenitoriListView.AnimationDuration = 0
    TutteListView.AnimationDuration = 0
  
  
  
End Sub

This sub handles setting up the tabstrip. It's called both when first loading the application and when re-creating the tabstrip, so there are no differences between when it works and when it doesn't (at least in terms of what pages are being loaded).
 
Last edited:

Sviluppatori Liceo Giovio

Member
Licensed User
The tabstrip is defined via the designer in a layout file.

I'm loading this layout into a panel, destroying the panel, recreating the panel and re-loading the layout. Not sure if that counts as creating a new tabstrip.
This works in the example project I attached to the original post, but in the main application it crashes.
 
Last edited:

Sviluppatori Liceo Giovio

Member
Licensed User
Yes, it can be reproduced easily. Just open up the side menu and press one of the bottom two buttons. This will switch out the panel. Then press the first one to go back to the initial layout. (Note: The first time the app starts it will download a couple files so it will load for a sec).

The file is too large so here is a link: https://u.teknik.io/3XmhK.zip
 

Sviluppatori Liceo Giovio

Member
Licensed User
I'm not sure as to why the third button causes a crash, perhaps I uploaded the project wrong.
As for pressing the login and going back that's...strange. It crashes completely on my device (iPhone 6).

How would I go about reusing the layout? Simply load it again? Wouldn't I still need to repopulate it? I'm destroying then recreating it in order to have as few objects "loaded" as possible.
Not only that but I still need to destroy it and then recreate it following a login in order to add an additional page, so I still need to figure out what the issue is.
 
Top