Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios indexPath.row上的prepareForSegue EXC_错误访问_Ios_Objective C_Iphone_Xcode_Xcode8 - Fatal编程技术网

Ios indexPath.row上的prepareForSegue EXC_错误访问

Ios indexPath.row上的prepareForSegue EXC_错误访问,ios,objective-c,iphone,xcode,xcode8,Ios,Objective C,Iphone,Xcode,Xcode8,我试图通过prepareForSegue函数下的一个序列传递数据,但我一直在获取exc_bad_访问权限 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; //NSIndexPath *indexPath = [NSIndexPath indexPathForRow:r

我试图通过prepareForSegue函数下的一个序列传递数据,但我一直在获取exc_bad_访问权限

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

NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];

//NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"itemListSegue"])
{
    itemList *vc = [segue destinationViewController];
    vc.inv = [inv_list objectAtIndex:indexPath.row];
    vc.title = vc.inv;
}
}
下面是我犯的错误

编辑: 库存清单声明如下:

@interface downloadInv (){
NSMutableArray *inv_list;
}
@interface itemList : UITableViewController

@property(nonatomic, strong) NSString *inv;
@end
在viewDidLoad中:

inv_list = [[NSMutableArray alloc] init];
内容:

vc.inv是inv_列表中的一个特定元素,我希望在选择表时将其传递给目标视图控制器

声明如下:

@interface downloadInv (){
NSMutableArray *inv_list;
}
@interface itemList : UITableViewController

@property(nonatomic, strong) NSString *inv;
@end

有人知道怎么解决这个问题吗


提前感谢。

因为列表中的
未声明为强属性,所以可能正在发布。
尝试这样声明:


@property(强,非原子)NSMutableArray*inv\u列表

请检查您的序列标识符,如果没有给出,可能会导致异常

否则,如果它是强属性,如:

@property(nonatomic,strong) NSString *inv_list;

它可以解决问题。

什么是
inv\u list
?它是数组吗?确保您在
prepareforsegue
中获得了正确的indexpat,而不是零!请说明
inv\u list
是如何定义的?告诉我们列表是什么,以及您试图填充的vc的属性是什么。尝试将其声明为强属性根据代码,inv\u list根本没有声明为属性,请尝试@property(强,非原子)NSMutableArray*inv\u list;