Can't figure out what's going on.
I'm building an iPhone-app that uses a scroll view with paging. The scroll view contains several views, whose view controllers are loaded up from the storyboard by calling:
[self.storyboard instantiateViewControllerWithIdentifier:@"identifier"];
I add the view controllers to a mutable array and add their views to the scroll view as subviews. After appearing on screen, the view controllers are deallocated, so target-actions don't work anymore.
When I enabled Zombie Objects, the debugger wrote this on sending an action to the controller:
*** -[StreamingViewController performSelector:withObject:withObject:]: message sent to deallocated instance 0x914f0e0
I really tried to fix this but without success, so every help is much appreciated.
Some more code:
StreamingViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Streaming View Controller"];
[self.pageControllers addObject:controller]; // adding view controller to mutable array
controller.view.frame = self.scrollView.frame;
[self.scrollView addSubview:controller.view];