编辑 - 已解决:问题是当我创建包含所有对象的字符串以放入 tableview 时。我用了“?” 分离每个对象和其中一个包含该字符的对象,因此数组中断。
[myString appendFormat:@"%@$%@$%@$%@?",
[currentCampeggioDict valueForKey:@"id"],
[currentCampeggioDict valueForKey:@"nome"],
[...]
NS Array *elencoCampeggi=[myString componentsSeparatedByString:@"?"];
That's it.
I have this problem: my app receives from an URL a XML file with a list of objects. The tableview
is populated by those objects. There are so many items, so I have to call several times the url, changing a parameter in it for example :
http://www.myurl.com?method=xxx&PAGE=1
http://www.myurl.com?method=xxx&PAGE=2
etc..
The last cell of the tableview
contains the sentence "Click to load next 25 objects" and it changes the page number for the URL, delete itself and reload the url, adding the new objects to the tableview.
After 4 times everything works great, but when I press the cell for the fifth, an exception appears with the following text:
Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 17 beyond bounds [0 .. 16]'
Any help? Thanks.
EDIT: some code: this is the part where I delete the last cell
-(void) loadTestData {
// fill moviesArray with test data
NSInteger lastRow = [CampeggiArray count]-1;
if (lastLoadedPage > 1){
[CampeggiArray removeObjectAtIndex:lastRow];
[self.tableView reloadData];
}
[...]