[MacRuby-devel] calling Objective-C method with block parameter

Eloy Duran eloy.de.enige at gmail.com
Thu Nov 18 01:59:01 PST 2010


Ah yes, this is one for a FAQ. Linking against a framework does not automatically make MacRuby read the BridgeSupport files that might be there. But if you use the MacRuby Kernel::framework method, it will do both. (Though it’s not necessary to do it from rb_main.rb, just before the code where you will use the framework.)

On Nov 18, 2010, at 10:52 AM, Alan Skipp wrote:

> A wonderful prize indeed!
> 
> Regarding the bug, I think I've been led astray by Xcode. If I add the framework in the usual way to an Xcode project, the class defintions within the framework become accessible to macruby. Therefore I assumed that by linking to the framework, macruby automatically loads it because I am able to create objects from the framework's header file. The failure only occurs when attempting to call methods that require a bridgesupport file.
> 
> If I explicitly load the framework in 'rb_main.rb', everything works correctly. I hadn't realised this step was necessary, as simply linking to the framework in Xcode appears to load it and make it available to macruby code.
> 
> 
> On 17 Nov 2010, at 17:26, Matt Aimonetti wrote:
> 
>> Congratulations!! You won a lifetime license to use MacRuby 0.7.1 for free ;)
>> 
>> I tested your framework and I wasn't able to reproduce the bug mentioned. I closed the ticket https://www.macruby.org/trac/ticket/1000#comment:2
>> But feel free to investigate more and reopen it if you find something new.
>> 
>> Thanks,
>> 
>> - Matt
>> 
>> On Wed, Nov 17, 2010 at 9:05 AM, Alan Skipp <al_skipp at fastmail.fm> wrote:
>> Ticket #1000 has been filed.
>> Does the 1000th ticket get a special prize?
>> 
>> On 17 Nov 2010, at 14:39, Eloy Duran wrote:
>> 
>> > That’s no good. Can you file a ticket? (Preferably with the test framework attached)
>> >
>> > On Nov 17, 2010, at 3:34 PM, Alan Skipp wrote:
>> >
>> >> Thanks for the reply. I have the bridgesupport file located in the '/Resources/BridgeSupport/' folder of the framework, but currently it is not automatically loaded. I've tried making a clean build to no avail and I've checked the built app package and the framework is copied and the bridgesupport file is present. I also created a new test project in Xcode (just in case something had went awry with the other project) and I had to explicitly call 'load_bridge_support_file' to get the framework working there also.
>> >>
>> >>
>> >> On 17 Nov 2010, at 13:42, Eloy Duran wrote:
>> >>
>> >>> The BridgeSupport file should be in a BridgeSupport directory inside the framework’s Resources directory. For example, Foundation’s BridgeSupport file is at: /System/Library/Frameworks/Foundation.framework/Resources/BridgeSupport/Foundation.bridgesupport
>> >>>
>> >>> On Nov 17, 2010, at 2:32 PM, Alan Skipp wrote:
>> >>>
>> >>>> Thanks for the info. I'd wrongly assumed that as blocks can be treated as Objective-C objects that I could just go ahead and use them in Macruby.
>> >>>> I have it working now, which is great, though I do have one more question.
>> >>>> Initially I was receiving the same errors after I'd included the framework with a bridgesupport file into my project. I finally got it working after invoking, 'load_bridge_support_file' in my controller class. Is there something I should be doing that would enable macruby to automatically detect and load the bridgesupport file included in my framework?
>> >>>>
>> >>>> Cheers,
>> >>>> Al
>> >>
>> >> _______________________________________________
>> >> MacRuby-devel mailing list
>> >> MacRuby-devel at lists.macosforge.org
>> >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> >
>> > _______________________________________________
>> > MacRuby-devel mailing list
>> > MacRuby-devel at lists.macosforge.org
>> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101118/6900a211/attachment-0001.html>


More information about the MacRuby-devel mailing list