Iphone 准备segue不兼容指针

Iphone 准备segue不兼容指针,iphone,ios6,nsmutablearray,uistoryboardsegue,Iphone,Ios6,Nsmutablearray,Uistoryboardsegue,我正在使用带有TableView和plist文件的故事板,使用以下源代码: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([@"detailList" isEqual:segue.identifier]) { NSIndexPath *index = [self.tableView indexPathForCell:sender]; DetailVi

我正在使用带有TableView和plist文件的故事板,使用以下源代码:

- (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*\uuuu strong”到类型为“NSMutableArray”的参数 *"

我要如何修复并删除此警报


Thanx

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

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

所以只需制作可变字典

@property (nonatomic, strong) NSMutableDictionary *saved;

setSaved:
方法是如何声明的?您确定detail实际上是一个DetailViewController*?这意味着_保存的是一个DetailViewController数组?这似乎不对。在我使用保存模式的DetailViewController中:“@property(nonatomic,strong)NSDictionary*SAVED”;在TableViewController中:“@property(nonatomic,strong)NSMutableArray*SAVED;”更改它,但仍然继续使用“NSMutableDictionary”上相同的allert noe,您尝试过DetailViewController*detail=(DetailViewController*)[\u保存的对象索引:index.row];
@property (nonatomic, strong) NSMutableDictionary *saved;