iOS 7b5 UINavigationControllers' setViewControllers:animated: crash
| Originator: | mikee179 | ||
| Number: | rdar://14722933 | Date Originated: | 8/13/2013 |
| Status: | Closed (Duplicate) | Resolved: | |
| Product: | iPhone SDK | Product Version: | iOS 7b5 |
| Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary:
Calling UINavigationController's setViewControllers:animated: method within a UIViewController that is in the process of loading (before viewDidAppear:) will result in the new top view controller's view being shown, but the old top view controller's navigation item will remain in the nav bar. If there are any action buttons in that navigation item, tapping them will cause a crash because its associated view controller has been dealloc'd
This is for an app built against the iOS 6 toolchain, but run under iOS 7. Simulator or device.
Steps to Reproduce:
1) Present a nav controller with a root view controller. give this root view controller a title and an action button with a custom action. Let's call it "view1".
2) In view1's viewDidLoad or viewWillAppear, instantiate a second view controller ("view2", with a local variable 'vc'), which has a different title and it's own action button. call [self.navigationController setViewControllers: @[vc] animated: NO];
3) UI will show view of view2, but navigation item of view1. Tapping action button in nav bar will cause crash.
Expected Results:
Navigation Item belongs to view 2 and action button call appropriate methods in view 2
Actual Results:
Navigation Item belongs to view 1. Tapping action button item causes crash.
Regression:
Functionality works as expected in iOS 6
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!