My app didn\'t have any crash until iOS 7.1 came out. Now on any removeFromSuperview
method, crash. For example: I got view controllers, and when I
please do the following:
1- debug the for (UIView *subView in [contentVc subviews])
and check how many times it iterate.
if it doesn't crash in the first hit you can add this line before you remove the view
if (subView.superView != nil)
else try to make sure that you are not releasing the views twice somewhere else as it's keep showing and will not crash till you remove it from it's superview.
UPDATE2: i will consider that you are will aware of memory leaks, and that you have good experience in it.
whenever you add a subview to a view, this will retain the object by 1 in addition to the original 1, that will equal 2, then directly after adding the subview you have to release it, which will decrement the retain count back to one. here is the trick: you don't have to release the subview or remove it from it's parent view to get rid of the remaining retain count. you can simply remove or release the parent view. get the NSMutableArray As an example.
remove the [mainView removeFromSuperview];
from the dealloc:
method. you can add it else where like viewWillDisappear:
method. dealloc method shouldn't contain anything other than the release calls.