TableView problem with 1.7 final but not in beta

You must Login before you can answer or comment on any questions.

Trying to work with final 1.7 (gotta submit today) but get that new error:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (0) must be equal to the number of rows contained in that section before the update (0), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted).'
There was no probem with Tableview with 1.7 beta.

Any solution?

7 Answers

I had the same problem on android and weird error returns java.lang.ClassCastException: ti.modules.titanium.ui.LabelProxy.

Anyway I solved the problem by not using same className for rows even when they use same styling. Just make them use a diff className regardless if they use same style or not.

— answered 3 years ago by Rey Bumalay
answer permalink
4 Comments
  • Rey, nice catch. Are you recommending adding a random number for each time it's looped & modified (or some form of unique on the end)?

    — commented 3 years ago by Jim Carter III

  • I find that a 'name' + row count number will suffice.

    — commented 3 years ago by Kosso .

  • The docs says that we can use same className for rows with similar styling although I think it doesn't work on 1.7.0 or 1.7.1.

    So I'm using a unique id or identifier for my rows but i think incrementing every iteration is also okay.

    — commented 3 years ago by Rey Bumalay

  • Show 1 more comment

You'll need to provide a sample of the code you're using to create your table. The error message alone isn't enough for anyone to help you.

— answered 3 years ago by Kosso .
answer permalink
1 Comment
  • I don't know which tableview gives this error and doesn't have much time for now to investigate. This was working fine with 1.7 beta which is why I posted that here hoping someone else have the same problem. Reverting to beta for now.

    — commented 3 years ago by Jean-Philippe Boily

Same here. Random crashes with 1.7, runs with 1.6.2

Snipp

var win = Titanium.UI.currentWindow;
 
var table = Titanium.UI.createTableView();
 
for(var cars = 0; cars < 200; cars +=1 )
{
    table.appendRow(Titanium.UI.createTableViewRow({
        title:'Row ' + cars,
    }));
 
}
 
win.add(table);

— answered 3 years ago by Bastian Sackermann
answer permalink
3 Comments
  • If you ever find a solution, please post it here! :). I tried the latest build on CI without luck.

    — commented 3 years ago by Jean-Philippe Boily

  • @Bastian: do you have latest Mac OS, TiStudio, TiSDK? What language is your Mac OS? Anything special that could explain that it crashes and not on Appcelerator's computers?

    — commented 3 years ago by Jean-Philippe Boily

  • Mhh, I'm on the latest Snow Leopard, TiStudio and while German is my native language, my Mac is in German...

    Unfortunaly I can't reproduce the error, because I switched back to 1.6.1 to integrate TiBar.

    — commented 3 years ago by Bastian Sackermann

Same, my app has similar logic where on first load all is fine but when i allow the user to do a refresh it tanks. Tried on 1.7.0 and 1.7.1

Filled a bug report here: http://jira.appcelerator.org/browse/TC-117

— answered 3 years ago by Jean-Philippe Boily
answer permalink
6 Comments
  • I can't reproduce this error. Tested with SDK 1.7.1 (and 1.7.0 beta) on iOS simulator and Android device (Droid original running 2.2.2).

    — commented 3 years ago by Tim Poulsen

  • Pretty weird...I have latest Mac OS, XCode, TiStudio, TiSDK, all that on a MBP. Only thing I could see, which would not make sense, is that my Mac OS is in french.

    — commented 3 years ago by Jean-Philippe Boily

  • I removed Ti Studio and resintalled it but still crashes

    — commented 3 years ago by Jean-Philippe Boily

  • Show 3 more comments

To all those having issues... paste JUST the following code in app.js and NOTHING else, clean the project and build... if it crashes, please paste the entire console log to pastebin or something and link it back here for me to review. I have tested this code with 1.7, 1.7.1 and 1.8ci

var win = Titanium.UI.createWindow();
 
var table = Titanium.UI.createTableView();
 
for(var cars = 0; cars < 200; cars +=1 )
{
    table.appendRow(Titanium.UI.createTableViewRow({
        title:'Row ' + cars,
    }));
 
}
 
win.add(table);
 
win.open();

— answered 3 years ago by Matt Apperson
answer permalink
6 Comments
  • Stack:

    [INFO] One moment, building ... [DEBUG] Detecting modules in /Users/macbook_pro_jpb/ti_studio_workspace/1.7.1 tableview crashing test/modules [DEBUG] Detecting modules in /Library/Application Support/Titanium/modules [INFO] Titanium SDK version: 1.7.1 [INFO] iPhone Device family: iphone [INFO] iPhone SDK version: 4.3 [INFO] iPhone simulated device: iphone [DEBUG] executing command: /usr/bin/killall iPhone Simulator [DEBUG] No matching processes belonging to you were found [DEBUG] finding old log files [DEBUG] executing command: mdfind -onlyin /Users/macbook_pro_jpb/Library/Application Support/iPhone Simulator/4.3 -name c6d53480-64db-497b-94a4-8c1d47791b9c.log [DEBUG] /Users/macbook_pro_jpb/Library/Application Support/iPhone Simulator/4.3/Applications/1B36CE69-5F94-4C30-856B-8EE638BA02AF/Documents/c6d53480-64db-497b-94a4-8c1d47791b9c.log [DEBUG] removing old log file: /Users/macbook_pro_jpb/Library/Application Support/iPhone Simulator/4.3/Applications/1B36CE69-5F94-4C30-856B-8EE638BA02AF/Documents/c6d53480-64db-497b-94a4-8c1d47791b9c.log [INFO] Launching application in Simulator [INFO] Launched application in Simulator (1.96 seconds) [DEBUG] executing command: xcodebuild -version [DEBUG] Xcode 3.2.6 [DEBUG] Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0 [DEBUG] BuildVersion: 10M2518 [INFO] Found 4.3.2 patch installed [DEBUG] App Spec: <DTiPhoneSimulatorApplicationSpecifier 0x100303c30> specified by path /Users/macbook_pro_jpb/ti_studio_workspace/1.7.1 tableview crashing test/build/iphone/build/Debug-iphonesimulator/1.7.1 tableview crashing test.app [DEBUG] SDK Root: <DTiPhoneSimulatorSystemRoot 0x100302040> path=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk version=4.3 name=Simulator - iOS 4.3 [DEBUG] using device family iphone [DEBUG] Session started [DEBUG] Session did end with error Error Domain=DTiPhoneSimulatorErrorDomain Code=1 UserInfo=0x10011dbc0 "L’application simulée s’est fermée." [INFO] Application has exited from Simulator

    — commented 3 years ago by Jean-Philippe Boily

  • Gist here, sorry...

    — commented 3 years ago by Jean-Philippe Boily

  • That said, if in Ti Studio, I set log level to trace, it seems to work...pretty weird!

    — commented 3 years ago by Jean-Philippe Boily

  • Show 3 more comments

I think that the problem is when you need to refresh the table and you use table.setData([]); I think that this command is async mode, so you need to wait until this command will finish to clean the table and then append the rows, so I used setTimeout command with 200 milliseconds and now the is't crashing

Your Answer

Think you can help? Login to answer this question!