How do I display data in a UITableView cell from an NSDictionary?
<p>Hi i received 2000 of datas from udp and display the values in tableview .What is the easiest method to do this ?</p>

<p>Now i am using Two nsthreads and one thread for receive data via udp and stores it in NSMutableDictionary.Another thread update the tableview using these Dictionary values. But it crashes my app.</p>

<p>Here is some code i used </p>

<p>I stored Received values like this</p>

<pre><code> NSMutableDictionary *dictItem
 CustomItem *item = [[CustomItem alloc]init];
 item.SNo =[NSString stringWithFormat:@"%d",SNo];
 item.Time=CurrentTime;
 [dictItem setObject:item forKey:[NSString stringWithFormat:@"%d",SNo]];
 [item release];
</code></pre>

<p>Delegate method i used and  i used CustomTableCells to display data as column vice.</p>

<pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
</code></pre>

<p>}</p>

<pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    return [dictItem count];
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *identifier = @"CustomTableCell";
    CustomTableCell *cell = (CustomTableCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) 
    {
        cell = [[[CustomTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
    }
    NSArray *keys = [dictItem allKeys];
    CustomItem *item = [dictItem objectForKey:[keys objectAtIndex:indexPath.row]];
    cell.SNo.text = item.SNo;
    cell.Time.text  = item.Time;
    return cell;
}
</code></pre>

<p>The errror is </p>

<p>Terminating app due to uncaught exception 'NSGenericException', reason: '<em>*</em> Collection  was mutated while being enumerated.'
2010-07-23 02:33:07.891 Centrak[2034:207] Stack: (
    42162256,
    43320108,
    42161198,
    43372629,
    41719877,
    41719345,
    9948,
    3276988,
    3237662,
    3320232,
    3288478,
    71153942,
    71153189,
    71096786,
    71096114,
    71296742,
    41650770,
    41440069,
    41437352,
    51148957,
    51149154,
    2925426
)
terminate called after throwing an instance of 'NSException'</p>

<p>Can anyone help me ?</p>

<p>Thanks in advance.......</p>
