作者:罂粟花很美也需要阳光 | 来源:互联网 | 2023-10-16 20:12
My app crashed and the code is the following:
我的应用程序崩溃,代码如下:
else if(...)
{
CGDetailView *detailView = [[CGDetailView alloc] init];
ContactGroup *cOntactGroup= [[ContactGroup alloc] init];
[contactGroup setObjectStatus:NewObject];
[detailView setContactGroup:contactGroup];
[detailView newContactGroup:YES];
[contactGroup release];
UIBarButtonItem *temporaryItem=[[UIBarButtonItem alloc] init];
temporaryItem.title = NSLocalizedString(@"back", @"");
self.navigationItem.backBarButtOnItem= temporaryItem;
[temporaryItem release];
[[self navigationController] pushViewController:detailView animated:YES];
[detailView release];
}
The error is "message sent to deallocated instance" and it regards the object of type CGDetailView. I use the alloc-init-release pattern, and I don't really understand why the app crashed. It usually works.
错误是“消息发送到解除分配的实例”,它关注CGDetailView类型的对象。我使用alloc-init-release模式,我真的不明白应用程序崩溃的原因。它通常有效。
iOS 7.1 and device is iPhone5 if that helps.
如果有帮助,iOS 7.1和设备是iPhone5。
1 个解决方案