Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5218] 6.2.0.GA tabGroup.setActiveTab error "A view can only be associated with at most one view controller at a time"

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2017-10-20T21:25:33.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterAnthony Chung
AssigneeShak Hossain
Created2017-09-21T06:13:30.000+0000
Updated2017-10-30T23:02:53.000+0000

Description

Attachments

FileDateSize
CI-Remote-iPhoneX-agents.png2017-10-11T07:06:50.000+0000296363
CI-Remote-iPhoneX-pipelines.png2017-10-11T07:06:51.000+0000174590
CI-Remote-iPhoneX-settings.png2017-10-11T07:07:44.000+0000216568

Comments

  1. Hans Knöchel 2017-09-21

    Please provide a full test-case that is reproducible, the current one looks copied from your app which makes it harder to pinpoint for us. Thanks!
  2. Damien Laureaux 2017-10-11

    Hi! Same issue for me since I use TiSDK 6.2.2.GA. I have tabGroup with ListViews (Alloy project). I get randomly this error:
       [ERROR] Script Error {
       [ERROR]     column = 4596;
       [ERROR]     line = 1;
       [ERROR]     message = "A view can only be associated with at most one view controller at a time! View <UITableView: 0x132890a00; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x17424fb40>; layer = <CALayer: 0x174220c40>; contentOffset: {0, 0}; contentSize: {0, 0}> is associated with <UITableViewController: 0x131e4e000>. Clear this association before associating this view with <UITableViewController: 0x13391ed50>.";
       [ERROR]     sourceURL = "file:///var/containers/Bundle/Application/F473A42A-D6EA-4675-8E63-E36D2C3F9FCA/CI%20Remote.app/alloy/controllers/PipelineList.js";
       [ERROR]     stack = "[native code]\nController@file:///var/containers/Bundle/Application/F473A42A-D6EA-4675-8E63-E36D2C3F9FCA/CI%20Remote.app/alloy/controllers/PipelineList.js:1:4596\ncreateController@file:///var/containers/Bundle/Application/F473A42A-D6EA-4675-8E63-E36D2C3F9FCA/CI%20Remote.app/alloy.js:1:5016\nController@file:///var/containers/Bundle/Application/F473A42A-D6EA-4675-8E63-E36D2C3F9FCA/CI%20Remote.app/alloy/controllers/index.js:1:1353\ncreateController@file:///var/containers/Bundle/Application/F473A42A-D6EA-4675-8E63-E36D2C3F9FCA/CI%20Remote.app/alloy.js:1:5016\nglobal code@file:///var/containers/Bundle/Application/F473A42A-D6EA-4675-8E63-E36D2C3F9FCA/CI%20Remote.app/app.js:1:272";
       [ERROR] }
       
    The PipelineList.js is the next screen after clicking on the first screen (Pipelines). I have joined my app with the two tabs with listView where I get a lot of crashes when the app starts or when I navigate to children screen with also listViews. !CI-Remote-iPhoneX-pipelines.png|thumbnail! !CI-Remote-iPhoneX-agents.png|thumbnail! !CI-Remote-iPhoneX-settings.png|thumbnail! I will try to reproduce this on a clean project but it seems like having these elements, is enough to crash the app: - tabGroup with a minimum of two tabs - listView on both tabs - activeTab() on any tabs at boot
  3. Sharif AbuDarda 2017-10-12

    Hello, Please provide a full test-case that is reproducible. We will be investigating the issue after we can reproduce the issue on our end. Thanks.
  4. Anthony Chung 2017-10-30

    [~timoa] Following might help... Forcing the stages to be separated on the thread in consecutive order by wrapping it in a defer function and a timeout of zero. (It might be affected by run on main thread.)
       		var tab = $.index.tabs[_tabIndex];
       
       		_.defer(function(){
       			// jscore and run on main thread require this defer
       			$.index.setActiveTab(tab);
       		},0);
       		_.defer(function(){
       			// $.index.tabs[_tabIndex].open(_controller);
       			tab.open(_controller);
       			tab = null;
       		},0);
       
  5. Anthony Chung 2017-10-30

    [~timoa] It looks like while the animation and switch is occuring, during the process the view is associated with two instead of one. The defer method, makes it go one at a time, and looks to have fixed it for me.
  6. Damien Laureaux 2017-10-30

    Thanks, @threethirds, I think that my problem is different because it appends randomly after I opened different windows in the same tab, without using setActiveTab(). But, your research about the main thread helped me to fix my issue. I have added this line to my tiapp.xml (like the kitchen sink v2 app) to use the main thread only and it solved my errors. Doesn't look to have lower performance:
       <property name="run-on-main-thread" type="bool">true</property>
       
  7. Anthony Chung 2017-10-30

    [~timoa] Great to hear you were able to get a win! I'm still trying to wrap my head around how run-on-main-thread and jscore changes the way we need to code in Titanium. Especially for larger code bases. At the moment I mainly infer what it breaks and work arounds for the moment :) These look like dependencies in hyperloop, so ironing out these issues will hopefully mean a stable base to try hyperloop. All the best!

JSON Source