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

[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

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号