rubymotion-community / sugarcube

Some sugar for your cocoa. RubyMotion helpers.
Other
422 stars 66 forks source link

modal.rb: passing a block to an Objective-C method - will be ignored #30

Closed sxross closed 11 years ago

sxross commented 11 years ago

Code like this:

SugarCube::Modal.present_modal(@create_view) do
  sort_display
end

generates the "passing a block to an Objective-C method - will be ignored warning. However,

SugarCube::Modal.present_modal(@create_view)

does not generate the warning. It's not clear whether this is a Sugarcube, iOS or RM issue. It's just new and potentially bothersome. The completion is never called.

$ motion -v 1.32 Xcode: Version 4.6 Simulator: Version 6.0 (369.2)

colinta commented 11 years ago

I did get the warning, but I also got the completion called:

(main)> picker = UIImagePickerController.new
=> #<UIImagePickerController:0x152396e0>
(main)> picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary
=> 0
(main)> picker.mediaTypes = [KUTTypeImage]
=> ["public.image"]
(main)> picker.allowsEditing = false
=> false
(main)> SugarCube::Modal.present_modal(picker) { puts "hi!" }
unknown: warning: passing a block to an Objective-C method - will be ignored
=> #<MainScreenController:0x1493f9a0>
hi!
(main)> 

:frowning:

GantMan commented 11 years ago

This is a RubyMotion warning. https://groups.google.com/forum/?fromgroups=#!topic/rubymotion/MQYGkb6TdLY

When I ran colinta's above code I didn't even get the warning, it worked fine. Soooo no clue how to help beyond that.

$motion -v
1.34
sxross commented 11 years ago

If everyone's comfortable that the block is being run but the results are ignored, then fine. If the block is being ignored and there's some other implication in this message, perhaps it bears more investigation. This issue is a couple of RM releases old, so the warning might have been removed or refined. What's the consensus?

colinta commented 11 years ago

I'll check one more time on a fresh dummy project.

colinta commented 11 years ago

successful, so closing this one.