热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

ios应用程序崩溃,“消息发送到解除分配的实例”-iosapplicationcrashedwith“messagesendtodeallocatedinstance”

Myappcrashedandthecodeisthefollowing:我的应用程序崩溃,代码如下:elseif(){CGDetailVie

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 个解决方案

#1


0  

Just try to get the point where your memory is released for this CGDetailView's object and you still calling a method on that object. You can do it by enabling Zombie Object from edit scheme, it will tell you the point where your app is crashing.

只是尝试获取为此CGDetailView对象释放内存的点,并且仍然在该对象上调用方法。你可以通过从编辑方案启用Zombie Object来实现它,它会告诉你应用程序崩溃的地方。


推荐阅读
author-avatar
罂粟花很美也需要阳光
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有