How-To: Solve ‘modifying layer that is being finalized’ iPhone SDK
Mar.18, 2009 in
Development, iPhone Development, iphone
Okay, so I’ve been getting the ‘modifying layer that is being finalized’ error message when i’m trying to release a subview from a superview:
[self.popupPreviewView release]; self.popupPreviewView = nil;
The best way to solve this (that I’ve found – please post a comment if you can provide a better one) is to remove the view from it’s superview rather than release it:
[self.popupPreviewView removeFromSuperview]; self.popupPreviewView = nil;
Tags: iPhone Development

April 25th, 2009 at 10:26 pm
The real issue in this case is rather the retain counter of popupPreviewView.
self.popupPreviewView = nil probably already does the release you need plus you need to remove the view from the superview because the superview retains the popupPreviewView.
a good practice is to avoid writing things such as [self.myproperty release]
September 21st, 2009 at 11:32 am
[...] How-To: Solve ‘modifying layer that is being finalized’ iPhone SDK – Tech Thought (tags: iphone_dev iphone_problem) [...]