Objective c -[国家/地区保留]:发送到解除分配实例0x6829280的消息
我正在使用带有选项卡栏应用程序的情节提要。在其中一个选项卡中,我创建了一个tableView。数据填充正常。尝试导航到同一选项卡中的另一个UITableViewController时出现问题 Countries.h(带故事板的类投标) 方法:Objective c -[国家/地区保留]:发送到解除分配实例0x6829280的消息,objective-c,ios,cocoa-touch,storyboard,Objective C,Ios,Cocoa Touch,Storyboard,我正在使用带有选项卡栏应用程序的情节提要。在其中一个选项卡中,我创建了一个tableView。数据填充正常。尝试导航到同一选项卡中的另一个UITableViewController时出现问题 Countries.h(带故事板的类投标) 方法: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { self.continent=[self.items obj
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.continent=[self.items objectAtIndex:[indexPath row]];
Countries *detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"theCountries"];
detailViewController.continentID=self.continent.continentID;
detailViewController.title=self.continent.continentName;
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
导航时,我收到-[Countries retain]:发送到解除分配实例0x6829280的消息。self.storyboard instantiveViewController的标识符:@“theCountries”没有分配实例吗?有什么问题吗?您的
detailViewController
对象超出了范围
顺便说一句,静态分析器会捕捉到该错误。我已经注释了[detailsViewController release],并由于未捕获的异常“NSInvalidArgumentException”而终止了应用程序,原因:'-[Continents SetContinental:::]:未识别的选择器发送到实例0x6b67f80'***第一次抛出调用堆栈:(0x159a022 0x172bcd6 0x159bcbd 0x1500ed0 0x1500cb2 0x387c 0x16c5c5 0x16c7fa 0xa0185d 0x156e936 0x156e3d7 0x14d1790 0x14d0d84 0x14d0c9b 0x14837d8 0x148388a 0xdb626 0x2342 0x22b5)终止调用时抛出异常声音,就像您没有实现
-setcontraction:
非常多。顺便说一句,只有名称以“new”、“init”或“init”开头的方法“复制”应该(在苹果框架中也应该)返回保留的对象。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.continent=[self.items objectAtIndex:[indexPath row]];
Countries *detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"theCountries"];
detailViewController.continentID=self.continent.continentID;
detailViewController.title=self.continent.continentName;
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}