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

iOS: Scrollable View removeView(int) Causes Error

    Details

      Description

      Problem

      ScrollableView's "removeView" method accepts either a view or an index to a view, but passing in an index to a view results in an error being raised.

      The Error

      2011-11-04 10:18:18.309 play[50939:1ab0b] -[__NSCFNumber krollObjectForBridge:]: unrecognized selector sent to instance 0x8c6d7a0
      [ERROR] Script Error = -[__NSCFNumber krollObjectForBridge:]: unrecognized selector sent to instance 0x8c6d7a0 at app.js (line 3).

      Why This Happens

      In TiScrollableViewProxy.m's removeView method, the "doomedView" is identified. But when we call self forgetProxy, we don't use the "doomedView", we use the "args", which will only be valid if a view was passed in, and not an integer.

      See the following erroneous code, taken from 1.8.0 at the time of this ticket's inception:

      TiScrollableViewProxy.m

      [doomedView performSelectorOnMainThread:@selector(detachView) withObject:nil waitUntilDone:NO];
      [self forgetProxy:args];
      [viewProxies removeObject:args];
      [self unlockViews];	
      

      Solution

      Change those two references to "args" to "doomedView", and everything works as it should.

      How To Reproduce

      Drop the following in an app.js. If you get a modal error screen, the bug is present. If you don't, then everything is working as it should.

      app.js

      Ti.UI.createScrollableView({
          views: [ Ti.UI.createView() ]
      }).removeView(0);
      

      Pull Request

      https://github.com/appcelerator/titanium_mobile/pull/629

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dtoth Dawson Toth
                Reporter:
                dtoth Dawson Toth
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration