I really can't figure this out. When I click a link to open Safari from within my app, browse through the webpage, then return to my app, I can open and browse two tabBarItems in my UITabBar. But, when I try to select the one atIndex: 0, I get an EXEC_BAD_ACCESS and the following :(. Can anyone help me figure out how to make this not happen? I currently don't have any code that executes in will or didEnterBackground or Foreground. None. So the problem must be in the UIViewController for the first tab. (Oh and I don't know why it's adding a subview. Related?). Thoughts?Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x0109ba63 objc_msgSend + 23 1 UIKit 0x0031f3df -[UIView(Internal) _didMoveFromWindow:toWindow:] + 966 2 UIKit 0x0031f1b0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 407 3 UIKit 0x0031f1b0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 407 4 UIKit 0x0031f1b0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 407 5 UIKit 0x0031f1b0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 407 6 UIKit 0x0031f1b0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 407 7 UIKit 0x0031dfc4 -[UIView(Hierarchy) _postMovedFromSuperview:] + 166 8 UIKit 0x00316dfc -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1080 9 UIKit 0x0031514f -[UIView(Hierarchy) addSubview:] + 57 10 UIKit 0x003725ac -[UITransitionView transition:fromView:toView:] + 563 11 UIKit 0x00371955 -[UITransitionView transition:toView:] + 129 12 UIKit 0x003a6383 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 459 13 UIKit 0x003a4d86 -[UITabBarController transitionFromViewController:toViewController:] + 64 14 UIKit 0x003a6b7e -[UITabBarController _setSelectedViewController:] + 263 15 UIKit 0x003a69ed -[UITabBarController _tabBarItemClicked:] + 352`推荐答案 BAD_ACCESS意味着您可能正在访问指向已释放内存的内容.在您描述的情况下,由于内存不足警告(尤其是不可见的警告),很有可能正在卸载视图.如果您不准备进行此卸载,则在重新加载视图时,通常会发生不好的事情.确保在视图控制器中适当地处理了viewDidUnload方法和相互的viewDidLoad.The BAD_ACCESS means you are likely accessing something that points to memory that has been released. In the situation you describe, it's very possible that your views are unloading due to a low memory warning - particularly ones that aren't visible. If you aren't prepared for this unloading, when the view reloads, bad things usually happen. Make sure you are appropriately handling your viewDidUnload method and the reciprocal viewDidLoad in your view controllers. 这篇关于从后台打开它并选择Tab atIndex:0后,我的iPhone应用程序崩溃了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-22 00:19