当前位置:首页 > 开发 > 移动开发 > 正文

[CALayer retain]: message sent to deallocated instance 0x7fb3e97a9970

发表于: 2014-12-31   作者:BlueSkator   来源:转载   浏览次数:
摘要: -[UIView addSubview:] causes the subview to be retained, and -[UIView removeFromSuperview] causes the view to be released. This is direct from Apple's UIView documentation. At that point, one of your

-[UIView addSubview:] causes the subview to be retained, and -[UIView removeFromSuperview] causes the view to be released. This is direct from Apple's UIView documentation. At that point, one of your objects needs to retain the CALayer or it will be deallocated.

I assumed that the CALayer was created by you directly. All UIViews are associated with CALayers; the CALayer is what a UIView draws into, and then its CALayer is composited onto the screen. If you're not working with CALayers directly, this is a symptom of another problem.

The core problem you're describing is an overrelease. It's possible you're not retaining a UIView when you should. I suggest you run the Xcode analyzer (in Xcode 4, choose the Product > Analyze) menu item and see what gets reported. Pay special attention to all of the memory management errors it reports.

[CALayer retain]: message sent to deallocated instance 0x7fb3e97a9970

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

编辑推荐
在XCode的以前版本中,如果遇到了 [代码]c#/cpp/oc代码: 1 message sent to deallocated instance
转:http://www.devdiv.com/home.php?mod=space&uid=50901&do=blog&id=50856 在XCode的以前版本中,
原帖地址:http://www.cnblogs.com/vicstudio/p/3150557.html iOS开发,最郁闷的莫过于程序毫无征兆
情景: 使用MethodSwizzle 实现对数组、字典 等系统方法的安全校验。显然能达到预期效果,但实际发
初级:第一步 为程序添加符号断点 malloc_error_break 方法如下。 目标效果:让程序崩溃时跳转到出
Unrecognized selector is an exception, and you can set a breakpoint on exceptions. In Xcode 4
这往往是引用的问题。ARC要求完整的前向引用,也就是说在MRC时代可能只需要在.h中申明@class就可以
常见的一个错误 在调用: BlogDB *blogDB = [[BlogDB alloc] init]; [blogDB saveBlog:self]; [blog
项目中导入一些开源的类库,里面会爆出一些ARC forbids explicit message send of'retain' 这种问题
10 CALayer
一、什么是CALayer 在iOS系统中,你能看得见摸得着的东西基本上都是UIView,比如一个按钮、一个文本
版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号