{ "id": "176243", "key": "TIMOB-28497", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "21199", "description": "", "name": "Release 10.0.1", "archived": false, "released": true, "releaseDate": "2021-07-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2021-07-20T09:46:20.000+0000", "created": "2021-06-24T08:09:59.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "NavigationWindow", "SplitWindow", "ios", "regression" ], "versions": [ { "id": "21050", "name": "Release 10.0.0", "archived": false, "released": true, "releaseDate": "2021-05-17" } ], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-07-20T09:46:20.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "With SDK 10.0.0.GA and the following example, iOS throws the error below. In lower versions it works properly\r\n\r\n{code:xml}\r\n\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\n\r\n\r\n{code}\r\n'UIViewControllerHierarchyInconsistency', reason: 'child view controller: should have parent view controller: but requested parent is:'\r\n{code}\r\n", "attachment": [ { "id": "67944", "filename": "SplitWithNavChildWindows.png", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-06-25T03:47:10.000+0000", "size": 886855, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Hierarchy error occurs with SplitWindow and NavigationWindow as of 10.0.0", "creator": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "458816", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I made a Classic version of your Alloy app in pure JS and it worked fine...\r\n{code:javascript}\r\nconst masterWindow = Ti.UI.createWindow({ title: \"Master View\" });\r\nmasterWindow.add(Ti.UI.createListView({\r\n\tsections: [\r\n\t\tTi.UI.createListSection({\r\n\t\t\titems: [\r\n\t\t\t\t{ properties: { title: \"Row 1\" } },\r\n\t\t\t\t{ properties: { title: \"Row 2\" } },\r\n\t\t\t\t{ properties: { title: \"Row 3\" } },\r\n\t\t\t],\r\n\t\t}),\r\n\t],\r\n}));\r\n\r\nconst detailWindow = Ti.UI.createWindow({ title: \"Detail View\" });\r\ndetailWindow.add(Ti.UI.createLabel({ text: \"Hello World!\" }));\r\n\r\nconst splitWindow = Ti.UI.iOS.createSplitWindow({\r\n\tdetailView: Ti.UI.createNavigationWindow({ window: detailWindow }),\r\n\tmasterView: Ti.UI.createNavigationWindow({ window: masterWindow }),\r\n\tbackgroundColor: \"white\",\r\n\tshowMasterInPortrait: true,\r\n});\r\nsplitWindow.open();\r\n{code}\r\n !SplitWithNavChildWindows.png|thumbnail! \r\n\r\n----\r\n\r\nHowever, if I wrap the {{SplitWindow}} within a {{NavigationWindow}}, it *crashes* as of Titanium 10.0.0. This is happening because there is a {{NavigationWindow}} within a {{NavigationWindow}} 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.\r\n\r\n{code:javascript}\r\nconst masterWindow = Ti.UI.createWindow({ title: \"Master View\" });\r\nmasterWindow.add(Ti.UI.createListView({\r\n\tsections: [\r\n\t\tTi.UI.createListSection({\r\n\t\t\titems: [\r\n\t\t\t\t{ properties: { title: \"Row 1\" } },\r\n\t\t\t\t{ properties: { title: \"Row 2\" } },\r\n\t\t\t\t{ properties: { title: \"Row 3\" } },\r\n\t\t\t],\r\n\t\t}),\r\n\t],\r\n}));\r\n\r\nconst detailWindow = Ti.UI.createWindow({ title: \"Detail View\" });\r\ndetailWindow.add(Ti.UI.createLabel({ text: \"Hello World!\" }));\r\n\r\nconst splitWindow = Ti.UI.iOS.createSplitWindow({\r\n\tdetailView: Ti.UI.createNavigationWindow({ window: detailWindow }),\r\n\tmasterView: Ti.UI.createNavigationWindow({ window: masterWindow }),\r\n\tbackgroundColor: \"white\",\r\n\tshowMasterInPortrait: true,\r\n});\r\nTi.UI.createNavigationWindow({ window: splitWindow }).open();\r\n{code}\r\n\r\n{code}\r\n[INFO] *** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller: should have parent view controller: but requested parent is:'\r\n[INFO] *** First throw call stack:\r\n[INFO] (\r\n[INFO] 0 CoreFoundation 0x00007fff20422fba __exceptionPreprocess + 242\r\n[INFO] 1 libobjc.A.dylib 0x00007fff20193ff5 objc_exception_throw + 48\r\n[INFO] 2 CoreFoundation 0x00007fff20422e98 -[NSException initWithCoder:] + 0\r\n[INFO] 3 UIKitCore 0x00007fff23f89a24 -[UIViewController _addChildViewController:performHierarchyCheck:notifyWillMove:] + 329\r\n[INFO] 4 ClassicAppTest 0x000000010660f4e4 -[TiUINavigationWindowProxy windowDidOpen] + 100\r\n{code}\r\n\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-06-25T03:53:02.000+0000", "updated": "2021-06-25T03:54:08.000+0000" }, { "id": "458817", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I've confirmed that ticket [TIMOB-27865] has caused this regression.\r\n\r\nIt's caused by the new {{\\[TiUINavigationWindowProxy windowDidOpen\\]}} method added...\r\nhttps://github.com/appcelerator/titanium_mobile/pull/12233/files#diff-370f5f4b50cfdee279868eb38fb97f1954436094edbe253d4b3805e99725e65f\r\n\r\n*Possible Solution:*\r\nI 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...\r\n{code:objc}\r\n- (UIViewController *)windowHoldingController\r\n{\r\n for (UIResponder *responder = [[self view].superview nextResponder]; responder != nil; responder = [responder nextResponder]) {\r\n if ([responder isKindOfClass:[UIViewController class]]) {\r\n return (UIViewController *) responder;\r\n }\r\n }\r\n return [[TiApp app] controller];\r\n}\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-06-25T22:41:05.000+0000", "updated": "2021-06-26T04:40:23.000+0000" }, { "id": "458824", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/12930", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-06-28T20:56:00.000+0000", "updated": "2021-06-28T20:56:00.000+0000" }, { "id": "458873", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Merged to master and 10_0_X", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2021-07-20T09:46:14.000+0000", "updated": "2021-07-20T09:46:14.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }