这可能很基础,但是...
我在Storyboard中的两个ViewControllers之间设置了一个标识符为clickBtn的segue。
现在我要在我的代码中这样调用它:
我在Storyboard中的两个ViewControllers之间设置了一个标识符为clickBtn的segue。
现在我要在我的代码中这样调用它:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"clickBtn"])
{
if(conditionVerified)
{
SecondViewController *controller = (SecondViewController *)segue.destinationViewController;
[controller setManagedObjectContext:self.managedObjectContext];
}
else
{
// If I enter here I get the error below
}
}
}
由于搜索实体名称“Link”时使用了非法的NSManagedObjectContext参数nil,应用程序终止,抛出未捕获的异常NSInvalidArgumentException。
实际上,如果进入else语句,我不想进行此转换。如何做到这一点?