編集 - 解決済み:問題は、テーブルビューに入れるすべてのオブジェクトを含む文字列を作成したときでした。「?」を使用しました。各オブジェクトとその文字を含むオブジェクトの 1 つを分離するため、配列が壊れました。
[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];
}
[...]