[TIMOB-28497] iOS: Hierarchy error occurs with SplitWindow and NavigationWindow as of 10.0.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-07-20T09:46:20.000+0000 |
Affected Version/s | Release 10.0.0 |
Fix Version/s | Release 10.0.1 |
Components | iOS |
Labels | NavigationWindow, SplitWindow, ios, regression |
Reporter | Brian GarcĂa |
Assignee | Joshua Quick |
Created | 2021-06-24T08:09:59.000+0000 |
Updated | 2021-07-20T09:46:20.000+0000 |
Description
With SDK 10.0.0.GA and the following example, iOS throws the error below. In lower versions it works properly
<Alloy>
<SplitWindow backgroundColor="white" showMasterInPortrait="true">
<!-- First window is the masterView -->
<NavigationWindow>
<Window title="Master View">
<ListView>
<ListSection headerTitle="Some items">
<ListItem title="Item 1" />
<ListItem title="Item 2" />
<ListItem title="Item 3" />
</ListSection>
</ListView>
</Window>
</NavigationWindow>
<!-- Second window is the detailView -->
<NavigationWindow>
<Window title="Detail View">
<Label>I am the detail view.</Label>
</Window>
</NavigationWindow>
</SplitWindow>
</Alloy>
'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<UINavigationController: 0x7fda2d885000> should have parent view controller:<TiViewController: 0x7fda2ac61920> but requested parent is:<TiRootViewController: 0x7fda2c02a200>'
Attachments
File | Date | Size |
---|---|---|
SplitWithNavChildWindows.png | 2021-06-25T03:47:10.000+0000 | 886855 |
I made a Classic version of your Alloy app in pure JS and it worked fine...
!SplitWithNavChildWindows.png|thumbnail! ---- However, if I wrap the
SplitWindow
within aNavigationWindow
, it *crashes* as of Titanium 10.0.0. This is happening because there is aNavigationWindow
within aNavigationWindow
which will cause this exception. Your Alloy XML isn't set up to do this, but I'm *guessing* Alloy is wrongly setting it up this way when it does the JS code generation.I've confirmed that ticket [TIMOB-27865] has caused this regression. It's caused by the new
\[TiUINavigationWindowProxy windowDidOpen\]
method added... https://github.com/appcelerator/titanium_mobile/pull/12233/files#diff-370f5f4b50cfdee279868eb38fb97f1954436094edbe253d4b3805e99725e65f *Possible Solution:* I think we need to change the [TiWindowProxy. windowHoldingController ](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/TitaniumKit/TitaniumKit/Sources/API/TiWindowProxy.m#L506-L513) method to be walk up the view hierarchy to find the first parent controller like this...PR (master): https://github.com/appcelerator/titanium_mobile/pull/12930
Merged to master and 10_0_X