准备segue不兼容的指针

时间:2013-03-19 11:11:26

标签: iphone ios6 nsmutablearray uistoryboardsegue

我正在使用带有TableView和plist文件的storyboard,使用此源:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([@"detailList" isEqual:segue.identifier]) {

        NSIndexPath *index = [self.tableView indexPathForCell:sender];
        DetailViewController *detail = [_saved objectAtIndex:index.row];
        [[segue destinationViewController] setSaved:detail];
    }
}

工作,如果我点击一张桌子,segue会向我展示正确的内容,但是在一条线上:

[[segue destinationViewController] setSaved:detail];

我有警告说:

  

不兼容的指针类型发送   'DetailViewController * __ strong'到'NSMutableArray类型的参数   *'

我需要做些什么来修复并删除此警报?

感谢名单

1 个答案:

答案 0 :(得分:0)

您正在发送可变对象(从NSMutableArray)到不可变对象(NSDictionary

@property (nonatomic, strong) NSDictionary *saved;

这里NSDictionary是不可变的,你从NSMutableArray发送对象(它是可变的)。

所以只需制作可变字典

@property (nonatomic, strong) NSMutableDictionary *saved;
相关问题