rubymotion-community/sugarcube

no view has been assigned to SugarCube::Adjust::adjust

pencilcheck opened this issue · 25 comments

I'm new to rubymotion and sugarcube. Just started yesterday, however I am hitting a block, I tried to use Cmd+click to repl into a view but somehow it is returning this error everytime I do that. I wonder if there is any solution to this problem?

Included sugarcube in Gemfile like this:

gem 'sugarcube', :require => 'sugarcube-all'

Ahh, no problem! The command-click feature is separate from the "SugarCube::Adjust" feature. You just need to do this:

gem 'sugarcube', :require => ['sugarcube', 'sugarcube-repl'] # you can use sugarcube-all, too, but you don't have to if you don't want to use all the packages

  1. command-click on a view
  2. now "self" is that view, so pass it to 'adjust'
    adjust self

    or

    a self
  3. now you can use 'blink', 'up/down', etc, and running 'tree' will highlight the view you clicked.

Let me know if this helps!

On May 29, 2014, at 11:28 AM, Penn Su notifications@github.com wrote:

I'm new to rubymotion and sugarcube. Just started yesterday, however I am hitting a block, I tried to use Cmd+click to repl into a view but somehow it is returning this error everytime I do that. I wonder if there is any solution to this problem?

Included sugarcube in Gemfile like this:

gem 'sugarcube', :require => 'sugarcube-all'


Reply to this email directly or view it on GitHub.

I am already using sugarcube-all, your advice doesn't work still giving me the same error when cmd-click a view. :(

Paste the error message, I'm sure it's something easy.
On May 31, 2014 10:18 AM, "Penn Su" notifications@github.com wrote:

I am already using sugarcube-all, your advice doesn't work still giving me
the same error when cmd-click a view. :(


Reply to this email directly or view it on GitHub
#141 (comment)
.

WARNING! BubbleWrap::HTTP is deprecated and will be removed, see https://github.com/rubymotion/BubbleWrap/issues/308
  WARNING! Switch to a different networking library soon - consider AFNetworking: http://afnetworking.com/
  WARNING! You can use the 'bubble-wrap-http' gem if you need compatibility: https://github.com/rubymotion/BubbleWrap-HTTP
     Build ./build/iPhoneSimulator-7.1-Development
     Build vendor/PixateFreestyle.framework
    Create ./build/iPhoneSimulator-7.1-Development/wwm-ios.app/Info.plist
2014-05-31 22:22:12.670 xcodebuild[82744:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XVim.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-05-31 22:22:12.672 xcodebuild[82744:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XCFixin_TabAcceptsCompletions.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-05-31 22:22:12.673 xcodebuild[82744:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-05-31 22:22:12.675 xcodebuild[82744:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/OMColorSense.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-05-31 22:22:12.676 xcodebuild[82744:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/KSImageNamed.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-05-31 22:22:12.678 xcodebuild[82744:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/DocExpander.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-05-31 22:22:12.679 xcodebuild[82744:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/DerivedData Exterminator.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-05-31 22:22:12.681 xcodebuild[82744:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
    Create ./build/iPhoneSimulator-7.1-Development/wwm-ios.dSYM
  Simulate ./build/iPhoneSimulator-7.1-Development/wwm-ios.app
2014-05-31 22:22:18.034 wwm-ios[82750:70b] Pixate Freestyle v2.1.3 (API 2) - Build 2014/04/25
(PXUIImageView_UIImageView(#a8d...)? 2014-05-31 22:22:21.135 wwm-ios[82750:1b03] adjust.rb:48:in `frame:': no view has been assigned to SugarCube::Adjust::adjust (RuntimeError)
    from repl.rb:17:in `frame:'
    from uiview.rb:19:in `to_s:'
2014-05-31 22:22:21.157 wwm-ios[82750:1b03] *** Terminating app due to uncaught exception 'RuntimeError', reason: 'adjust.rb:48:in `frame:': no view has been assigned to SugarCube::Adjust::adjust (RuntimeError)
    from repl.rb:17:in `frame:'
    from uiview.rb:19:in `to_s:'
'
*** First throw call stack:
(
    0   CoreFoundation                      0x0300e1e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x0159b8e5 objc_exception_throw + 44
    2   wwm-ios                             0x00e0972a _ZL10__vm_raisev + 346
    3   wwm-ios                             0x00e09808 rb_vm_raise + 216
    4   wwm-ios                             0x00d0da56 rb_f_raise + 70
    5   wwm-ios                             0x00de4936 rb_vm_dispatch + 4870
    6   wwm-ios                             0x004e217c vm_dispatch + 1100
    7   wwm-ios                             0x004eb6c6 rb_scope__frame:__ + 198
    8   wwm-ios                             0x00dfe5ad _ZL20dispatch_rimp_callerPFP11objc_objectS0_P13objc_selectorzEmS1_iPKm + 46445
    9   wwm-ios                             0x00de4fca rb_vm_dispatch + 6554
    10  wwm-ios                             0x0075c5ac vm_dispatch + 1100
    11  wwm-ios                             0x00765066 rb_scope__frame:__ + 246
    12  wwm-ios                             0x00dfe5ad _ZL20dispatch_rimp_callerPFP11objc_objectS0_P13objc_selectorzEmS1_iPKm + 46445
    13  wwm-ios                             0x00de4fca rb_vm_dispatch + 6554
    14  wwm-ios                             0x00555bdc vm_dispatch + 1100
    15  wwm-ios                             0x0055dd27 rb_scope__to_s:__ + 1831
    16  wwm-ios                             0x00dfe5ad _ZL20dispatch_rimp_callerPFP11objc_objectS0_P13objc_selectorzEmS1_iPKm + 46445
    17  wwm-ios                             0x00de4fca rb_vm_dispatch + 6554
    18  wwm-ios                             0x00d46112 rb_obj_inspect + 546
    19  wwm-ios                             0x00dfe5ad _ZL20dispatch_rimp_callerPFP11objc_objectS0_P13objc_selectorzEmS1_iPKm + 46445
    20  wwm-ios                             0x00de4fca rb_vm_dispatch + 6554
    21  wwm-ios                             0x00d3f82b rb_inspect + 219
    22  wwm-ios                             0x00e25cce -[RMREPL evaluateExpression:] + 286
    23  wwm-ios                             0x00e26126 -[RMREPL start] + 230
    24  Foundation                          0x01cb7a07 -[NSThread main] + 76
    25  Foundation                          0x01cb7966 __NSThread__main__ + 1275
    26  libsystem_pthread.dylib             0x045f75fb _pthread_body + 144
    27  libsystem_pthread.dylib             0x045f7485 _pthread_struct_init + 0
    28  libsystem_pthread.dylib             0x045fccf2 thread_start + 34
)
libc++abi.dylib: terminating with uncaught exception of type RuntimeError

================================================================================
The application terminated. A crash report file may have been generated by the
system, use `rake crashlog' to open it. Use `rake debug=1' to restart the app
in the debugger.
================================================================================

WARNING: Automatic dependency detection does not work with motion-support. Turn it off in your Rakefile:

  app.detect_dependencies = false

Hmm, there's definitely something odd here, because the error seems to happen before returning to the REPL...

Try using version 1.6.2, that one defines the 'frame' helper in a different way, and it might help solve this.

Sorry, just realized you ARE using the latest version.

I'm really confused by this... in the to_s method it's calling 'self.frame', and that's calling the 'MotionRepl#frame' method. (O_o)?

If you open up to_s/uiview (bundle show sugarcube) you could try adding some debug info to the to_s method, e.g.

p id: self.object_id, cls: self.class

Essentially, I don't understand why to_s ends up calling Adjust::frame

This is the content of my Gemfile, maybe it could offer some clues.

source 'https://rubygems.org'

gem 'rake'
gem 'bubble-wrap'
gem 'sugarcube', :require => ['sugarcube-all']
gem 'geomotion'
gem 'motion-kit'
gem 'motion-support'
gem 'motion-pixatefreestyle'

And btw, which folder has the uiview code?

Sorry I'm confused by this last question... the answer might be
"sugarcube-to_s", but I'm not sure what you meant actually...
On Jun 1, 2014 1:43 AM, "Penn Su" notifications@github.com wrote:

And btw, which folder has the uiview code?


Reply to this email directly or view it on GitHub
#141 (comment)
.

you said If you open up to_s/uiview (bundle show sugarcube) you could try adding some debug info to the to_s method
I have no idea what you mean.

Ah.

> find `bundle show sugarcube` -name 'uiview.rb'
.../vendor/ruby/2.0.0/bundler/gems/sugarcube-0e7dd48b3c70/lib/sugarcube-animations/uiview.rb
.../vendor/ruby/2.0.0/bundler/gems/sugarcube-0e7dd48b3c70/lib/sugarcube-to_s/uiview.rb
.../vendor/ruby/2.0.0/bundler/gems/sugarcube-0e7dd48b3c70/lib/sugarcube-uikit/uiview.rb
> subl .../vendor/ruby/2.0.0/bundler/gems/sugarcube-0e7dd48b3c70/lib/sugarcube-to_s/uiview.rb

Does that make any sense?

(UIImageView(#a4f6160, [[0.0, 0...)? {:id=>172974432, :cls=>UIImageView}

This is what I get when I hold cmd and hover on a view, and when I click it just crashes

Hmm, that looks right to me. I dunno, man! If you can share a project that reproduces this I'll look into it further, but this is a one-of-a-kind bug, and this is in code that I use every day.

Reproduced it! Just needed to include all your gems. I'll figure out which one is causing trouble.

Cool

On Thursday, June 5, 2014, Colin T.A. Gray notifications@github.com wrote:

Reproduced it! Just needed to include all your gems. I'll figure out which
one is causing trouble.


Reply to this email directly or view it on GitHub
#141 (comment)
.

This is something in the REPL; from inside the to_s method of UIView, calling self.frame calls MotionRepl#frame. That ain't right...

I think this is a RubyMotion bug. I filed a ticket with HipByte.

This short AppDelegate can reproduce the error:

https://gist.github.com/colinta/4e2910acd35c42add9c7

In the meantime, you should be able to use the tree command without cmd+click.

(main)> tree
  0: . UIWindow(#195092e0, [[0.0, 0.0], [320.0, 568.0]])
  1: +-- UILayoutContainerView(#1559dd50, [[0.0, 0.0], [320.0, 568.0]])
  2: |   +-- UINavigationTransitionView(#115b7930, [[0.0, 0.0], [320.0, 568.0]])
  3: |   |   `-- UIViewControllerWrapperView(#199e11a0, [[0.0, 0.0], [320.0, 568.0]])
  4: |   |       `-- UIView(#155a0aa0, [[0.0, 0.0], [320.0, 568.0]])
...

And you can use adjust 4 to select a view, based on the number on the left. This actually works much better than the cmd+click feature (I never cmd+click, because it doesn't alway get the view I want).

I'll keep this page up-to-date if I learn more.

I pushed a (hopefully temporary) fix for this in 1.6.3. Watson tells me that MotionRepl can't handle what I want it to do right now.

So can I just run bundle install and it will be fixed? 👍

Yes I think so! Our if you want to just update sugarcube to latest:

bundle update sugarcube

On Jun 6, 2014 10:19 PM, "Penn Su" notifications@github.com wrote:

So can I just run bundle install and it will be fixed? [image: 👍]


Reply to this email directly or view it on GitHub
#141 (comment)
.

haha, it's sort of working. At least it doesn't crash. The red border that usually will appear around the views are not gone, and hovering on different element doesn't change the selection :(

That could have something to do with your views. The cmd+click feature is
spotty, which is why I prefer to just use 'tree'.

Try removing the repl package by using "sugarcube-common" instead of -all,
see if that changes anything.
On Jun 8, 2014 2:54 AM, "Penn Su" notifications@github.com wrote:

haha, it's sort of working. At least it doesn't crash. The red border that
usually will appear around the views are not gone, and hovering on
different element doesn't change the selection :(


Reply to this email directly or view it on GitHub
#141 (comment)
.