I can't help you with that little information. Typically this kind of error has nothing to do with table views specifically. It is a generic error. If you are seeing it with a table view then maybe you are doing something wrong with how you implemented your table views. Are you perhaps implementing your cell views using a view controller? That could trigger this error. Cells should be standalone views, not views belonging to a view controller. That might show up if your GetCell() method is constructing a view controller and then adding using its view as a part of the returned table cell.
Basically what you're looking for is any code which constructs a view controller object (of any type) and then fetches its View property and adds it as a subview of something else. Try searching for ".View". You could also perhaps be implementing LoadView in a class which inherits from UITableViewController. The UITableViewController class already implements LoadView, which creates a UITableView and assigns it to the View property. If you are overriding that method and also assigning to the View property then it might also complain about that. -- Adam Kemp [email protected] (512) 683-6058 From: Mike Murdock <[email protected]> To: Adam Kemp <[email protected]>, Date: 09/24/2012 01:20 PM Subject: RE: [MonoTouch] UIViewControllerHierarchyInconsistency issue after updating to ios6 Adam, I am having this issue throughout my project when it comes to loading tableviewcontrollers. When trying to set my tables source it crashes with this error. Do you have any examples of how this should be done in table view controller the correct way. Thanks Michael Murdock -----Original Message----- From: [email protected] [ mailto:[email protected]] On Behalf Of Adam Kemp Sent: Monday, September 24, 2012 11:46 AM To: [email protected] Subject: Re: [MonoTouch] UIViewControllerHierarchyInconsistency issue after updating to ios6 > * : UIViewControllerHierarchyInconsistency Reason: > * A view can only be associated with at most one view > controller at a time! This issue is probably more related to iOS 5 than iOS 6. Starting in iOS 5 they added the ability to have child view controllers. Prior to iOS 5 you were told never to add a UIViewController's View as a subview of another view (other than the window, of course). If you were careful and lived with certain shortcomings (like lack of notifications for things like rotation notifications) then you could get away with it, but it was never really supported. In iOS 5 they provided an official mechanism for doing this. They provided methods like AddChildViewController and RemoveFromParentViewController, as well as notification methods Will/DidMoveToParentViewController. As part of that change they started to enforce a relationship between the hierarchy of view controllers and the hierarchy of their views. That is, if a view controller is a child of another view controller then its view must also be a child of (perhaps indirectly) of the same view controller's view. Likewise, a view controller's view should not be a child (directly or indirectly) of another view controller's view if it is not a child of that view controller itself. This requirement is checked in certain situations, and if they find a violation then they raise that assertion. Apparently your code violated that requirement. The solution is to use the new API to tell iOS about the relationship between the view controllers. -- Adam Kemp [email protected] (512) 683-6058 _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
