Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-11986

iOS: App crashes with: "A view can only be associated with at most one view controller at a time"

    Details

      Description

      Same build is tested on a device with ios5 and multiple devices with ios6. The problem is consistent on ios6 devices, while ios5 devices work fine.

      Unfortunately I can't paste a self contained example of the working code, but here's what's going on.

      From one tab, another tab is set active with a window opened (some of the views and the window are earlier declared and previously used).

      this is the code, but it's pretty generic if out of context...

      self.open = function() {
      trip_tab.open(win,

      {animated: false}

      );
      tabGroup.setActiveTab(trip_tab).open();
      };

      ...
      ...
      ...

      self.open();

      Here's the console log:

      [ERROR] The application has crashed with an unhandled exception. Stack trace:
      0 CoreFoundation 0x03230012 __exceptionPreprocess + 178
      1 libobjc.A.dylib 0x02f93e7e objc_exception_throw + 44
      2 CoreFoundation 0x0322fdeb +[NSException raise:format:] + 139
      3 UIKit 0x00df2309 -[UIView(Internal) _setViewDelegate:] + 226
      4 UIKit 0x00e895ac +[UIViewController setViewController:forView:] + 40
      5 UIKit 0x00e85a90 -[UIViewController setView:] + 521
      6 Citybot 0x00080aec -[TiViewController loadView] + 92
      7 Citybot 0x000c6863 -[TiUITabController loadView] + 179
      8 UIKit 0x00e85648 -[UIViewController loadViewIfRequired] + 73
      9 UIKit 0x00e85882 -[UIViewController view] + 33
      10 UIKit 0x00e85b2a -[UIViewController contentScrollView] + 36
      11 UIKit 0x00e9cef5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
      12 UIKit 0x00e9cfdb -[UINavigationController _layoutViewController:] + 43
      13 UIKit 0x00e9d286 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
      14 UIKit 0x00e9d381 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
      15 UIKit 0x00e9deab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
      16 UIKit 0x00e9dfc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
      17 UIKit 0x00e9e055 -[UINavigationController __viewWillLayoutSubviews] + 33
      18 UIKit 0x00fa33ab -[UILayoutContainerView layoutSubviews] + 233
      19 UIKit 0x00df492d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279
      20 libobjc.A.dylib 0x02fa76b0 -[NSObject performSelector:withObject:] + 70
      21 QuartzCore 0x02145fc0 -[CALayer layoutSublayers] + 240
      22 QuartzCore 0x0213a33c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468
      23 QuartzCore 0x0213a150 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
      24 QuartzCore 0x020b80bc _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 324
      25 QuartzCore 0x020b9227 _ZN2CA11Transaction6commitEv + 395
      26 QuartzCore 0x0215bb50 +[CATransaction flush] + 52
      27 UIKit 0x00dba52f _afterCACommitHandler + 132
      28 CoreFoundation 0x031f8afe _CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION_ + 30
      29 CoreFoundation 0x031f8a3d __CFRunLoopDoObservers + 381
      30 CoreFoundation 0x031d67c2 __CFRunLoopRun + 1106
      31 CoreFoundation 0x031d5f44 CFRunLoopRunSpecific + 276
      32 CoreFoundation 0x031d5e1b CFRunLoopRunInMode + 123
      33 GraphicsServices 0x0381c7e3 GSEventRunModal + 88
      34 GraphicsServices 0x0381c668 GSEventRun + 104
      35 UIKit 0x00da465c UIApplicationMain + 1211
      36 Citybot 0x000068a8 main + 456
      37 Citybot 0x000031d5 start + 53
      2012-10-02 17:36:09.101 Citybot[63976:c07] *** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <TiUIWindow: 0xa5fb660; frame = (0 0; 320 416); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0xa5fb3f0>> is associated with <TiUITabController: 0xa5ee590>. Clear this association before associating this view with <TiUITabController: 0xb2202e0>.'

          • First throw call stack:
            (0x3230012 0x2f93e7e 0x322fdeb 0xdf2309 0xe895ac 0xe85a90 0x80aec 0xc6863 0xe85648 0xe85882 0xe85b2a 0xe9cef5 0xe9cfdb 0xe9d286 0xe9d381 0xe9deab 0xe9dfc9 0xe9e055 0xfa33ab 0xdf492d 0x2fa76b0 0x2145fc0 0x213a33c 0x213a150 0x20b80bc 0x20b9227 0x215bb50 0xdba52f 0x31f8afe 0x31f8a3d 0x31d67c2 0x31d5f44 0x31d5e1b 0x381c7e3 0x381c668 0xda465c 0x68a8 0x31d5)
            [INFO] Application has exited from Simulator

      I just installed 2.1.3 rc2 from here http://builds.appcelerator.com.s3.amazonaws.com/mobile/2_1_X/mobilesdk-2.1.3.v20120927181611-osx.zip

      I was hoping the problem was this (there is in fact map used in that view/window):
      TIMOB-10891 iOS 6: Repeatedly opening a tab group containing a map view crashes the application. (Known issue in RC)
      (described here: http://developer.appcelerator.com/blog/2012/09/titanum-2-1-3-rc2-is-released-with-additional-fixes-for-ios-6-and-iphone-5.html )

      But after updating from previous rc to rc2 the problem still exits...

      Please contact me – I'll be happy to assist with troubleshooting this.

      Thank you.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vduggal Vishal Duggal (Inactive)
                Reporter:
                zhenya Zhenya Kogan
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-15123
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration