iOS Question (ExpandableTableView) Invalid update: invalid number of rows in section 0

schimanski

Well-Known Member
Licensed User
Longtime User
I can't find the problem in my code. Every second start of the app, i get this error when i click on an item of the ExpandbaleTableView. It does't matter, if it is release or debug.mode. The exception is raised in line tv.EndUpdates of the etv-class.


B4X:
Error occurred on line: 102 (ExpandableTableView)
Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (18) must be equal to the number of rows contained in that section before the update (4), plus or minus the number of rows inserted or deleted from that section (6 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).
Stack Trace: (
  CoreFoundation       <redacted> + 150
  libobjc.A.dylib      objc_exception_throw + 38
  CoreFoundation       <redacted> + 0
  Foundation           <redacted> + 90
  UIKit                <redacted> + 8666
  EIS                  -[B4ITableView EndUpdates] + 46
  EIS                  -[b4i_expandabletableview _tv_selectedchanged:::] + 2800
  CoreFoundation       <redacted> + 68
  CoreFoundation       <redacted> + 300
  EIS                  +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1788
EIS                  -[B4IShell runMethod:] + 496
EIS                  -[B4IShell raiseEventImpl:method:args::] + 1982
EIS                  -[B4IShellBI raiseEvent:event:params:] + 1332
EIS                  +[B4IObjectWrapper raiseEvent:::] + 220
EIS                  -[B4ITableViewDelgate tableView:didSelectRowAtIndexPath:] + 322
UIKit                <redacted> + 918
UIKit                <redacted> + 194
UIKit                <redacted> + 308
UIKit                <redacted> + 466
CoreFoundation       <redacted> + 20
CoreFoundation       <redacted> + 278
CoreFoundation       <redacted> + 914
CoreFoundation       CFRunLoopRunSpecific + 476
CoreFoundation       CFRunLoopRunInMode + 106
GraphicsServices     GSEventRunModal + 136
UIKit                UIApplicationMain + 1440
EIS                  main + 108
libdyld.dylib        <redacted> + 2
)

Thanks for help....
 

schimanski

Well-Known Member
Licensed User
Longtime User
Ok. I have made an small demo-project and the exception doesn't raise. Now I have isolated every line and the problem ist a callcubdelayed in my app_start:

B4X:
Private Sub Application_Start (nav As NavigationController)

    ' Initialize the TabBarController
    TabControl.Initialize("TabControl")
    NavControl.Initialize("NavControl")
  
    Konferenz.InitKonferenz
    Kontakt.InitKontakt
    Einstellungen.InitEinstellungen
    Info.InitInfo
  
    NavControl.NavigationBarVisible = True    ' sets the NavigationBar to visible (by default)
  
    ' Set the pages to the TabBarController
    TabControl.Pages = Array(Kontakt.pageKontakte, Konferenz.pageKonferenz, Einstellungen.pageEinstellungen, Info.pageInfo)
  
    ' Set the TabBarController to the Application
    App.KeyController = TabControl
  
    App.IdleTimerDisabled = True    'Solange die App im Vordergrund ist, ist der Bildschirm-Timeout abgeschaltet'
    DateTime.TimeFormat="HH:mm:ss"
  
    App.RegisterUserNotifications(True, True, True)
    App.RegisterForRemoteNotifications
    CheckForPushMessage
  
    manager.Initialize
    If manager.GetAll.Size = 0 Then
        InitSettings
    End If
  
    Kontakt.Kontakte_initilisieren                               => read mykontakt.file
    Kontakt.ListeKontakte_erstellen                            => make my etv
    'Status immer senden, wenn Activity Main gestartet wird"
    CallSubDelayed(LadeService, "Status_senden")      => after callSubDelayed, the excetion above is raised every second start

  
End Sub

B4X:
Aktuellen Status an den Server senden'
Sub Status_senden
    Try
        Dim OnlineZeit As String
        DateTime.DateFormat="dd.MM"
        DateTime.TimeFormat="HH:mm"
        OnlineZeit="onl. " & DateTime.Date(DateTime.Now) & " um " & DateTime.Time(DateTime.Now)
        DateTime.DateFormat="dd.MM.yyyy"
        DateTime.TimeFormat="HH:mm:ss"
  
        Dim Statusmeldung As String
        If Main.manager.GetString("Status")="kein Status" Then
            Statusmeldung=OnlineZeit
        Else
            Statusmeldung=Main.manager.GetString("Status")
        End If
              
        Dim Status As HttpJob
        Status.Initialize("StatusSenden", Me)
        Status.PostString(ServerPfad & "/EIS?passwort=" & Main.manager.GetString("PasswortServer") & "&type=status&absender=" & Main.manager.GetString("Absender"), Statusmeldung)
    Catch
        Fehler_senden("LadeService, Status_senden, " & LastException.Description)
    End Try
end sub
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
I have created a small example. The problem ist not the CallSubDelayed. The exception raises every time, when I init an new etv. The button loads a new map and init a new etv-list, that's the problem. I have tried to clear the etv, but only a new start can show the new etv.
 

Attachments

  • ETV_sample.zip
    10 KB · Views: 207
Upvote 0
Top