Reputation: 4264
I am working on an app targeted for > iOS 4. In this app I display a UIWebView as modalView (inside an UIViewController which is pushed from an UITableViewController living in an UINavigationController ;)):
SettingsViewController *settings = [[SettingsViewController alloc] initWithNibName:@"SettingsView" bundle:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:settings];
[self.navigationController presentModalViewController:navController animated:YES];
[settings release];
[navController release];
This shows a modal view with a UITableView. Once a specific row is tapped my browser view controller is pushed:
WebBrowserViewController *vc = [[WebBrowserViewController alloc] initWithNibName:@"WebBrowserView" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
[vc goToUrl:@"http://www.example.com"];
[vc release];
Inside the WebBrowserViewController is an UIWebView and some browser controls (address bar, back and refresh buttons). This all works as expected.
On to the problem: If there are youtube videos embedded on a website and those are clicked the youtube player launches fullscreen. Once I close the youtube player (Done button) the player closes, apparently my modal view closes too and the app crashes after showing my root view controller for a second.
This is the console output:
2011-02-24 14:52:51.109 MyApp[498:307] modifying layer that is being finalized - 0x14eda0
2011-02-24 14:52:51.113 MyApp[498:307] modifying layer that is being finalized - 0x14b590
2011-02-24 14:52:51.117 MyApp[498:307] modifying layer that is being finalized - 0x14c630
2011-02-24 14:52:51.262 MyApp[498:307] modifying layer that is being finalized - 0x14eda0
2011-02-24 14:52:51.270 MyApp[498:307] *** -[CALayer sublayers]: message sent to deallocated instance 0x178fe0
My guess is that once the youtube player is launched my modal view controller is released and jumping back to it fails. I wasn't successful in finding the place to add a retain or similar …
Anyone seen this happen and can give me a hint what to do?
Thanks, Mark.
Upvotes: 3
Views: 1345
Reputation: 27214
The error "modifying layer that is being finalized"
occurs when you are trying to modify the properties of a CALayer
when it is in the process of being deallocated. I've seen this happen when I've accidentally used an accessor to clear a property on a CALayer
while within that layer's -dealloc
method.
Upvotes: 1