I have the following code to make a table from string turned into a dictionary:

```
- (void)viewDidLoad {
    [super viewDidLoad];

    testArray = [[NSArray alloc] init];
    NSString *testString = @"Sam|26,Hannah|22,Adam|30,Carlie|32";
    testArray = [testString componentsSeparatedByString:@","];

    dict = [NSMutableDictionary dictionary];
    for (NSString *s in testArray) {
        testArray2 = [s componentsSeparatedByString:@"|"];
        [dict setObject:[testArray2 objectAtIndex:1] forKey:[testArray2 objectAtIndex:0]];
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";  

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell.
    if (testArray.count >indexPath.row) {
        cell.textLabel.text = [[dict allKeys] objectAtIndex:[indexPath row]];
        cell.detailTextLabel.text = [dict objectForKey:cell.textLabel.text];
    }

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;
}

```

What I would like is for the selected row title to be set as the title on my detail view.

I tried with:

```
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    self.detailController.title = [[dict allKeys] objectAtIndex:[indexPath row]];

    [self.navigationController pushViewController:self.detailController animated:YES];
}

```

But I get an "EXC\_BAD\_ACCESS" error.

It works fine if I use @"1" as title, it's just something with my dictionary call that's wrong, I assume.