[MacRuby-devel] need help to get the Apple Remote Wrapper working with MacRuby

Matt Aimonetti mattaimonetti at gmail.com
Mon Jun 29 10:23:43 PDT 2009


Hi Guys,

 I wanted to port RubyCocoa old Apple Remote example to MacRuby but I
encountered some issues. It looks like I'm now stuck and need some help :(

Here is the code:
http://github.com/mattetti/apple-remote-wrapper/tree/master

I took Martin's source code, updated it to objective-c 2, enabled the GC,
made sure the demos were still working. Created a new framework target and
added bridgesupport.

FYI to generate the BridgeSupport file, do the following:

$ mkdir -p
~/src/RemoteControlWrapper_R962/build/Release/AppleRemote.framework/Resources/BrideSupport/
$ gen_bridge_metadata -f
~/src/RemoteControlWrapper_R962/build/Release/AppleRemote.framework/ -o
~/src/RemoteControlWrapper_R962/build/Release/AppleRemote.framework/Resources/BrideSupport/AppleRemote.bridgesupport


bs generated file: http://gist.github.com/137201

I then created a new macruby xcode project, loaded the framework, created a
new controller and binded it using IB.

Here is my controller:

class Controller

  def awakeFromNib
    remoteControl = AppleRemote.alloc.initWithDelegate(self)
    remoteControl.startListening(self)
    p remoteControl.isListeningToRemote
  end

    # - (void) sendRemoteButtonEvent: (RemoteControlEventIdentifier) event
pressedDown: (BOOL) pressedDown remoteControl: (RemoteControl*)
remoteControl;
  def sendRemoteButtonEvent(event, pressedDown:pressed,
remoteControl:remote)
   p 'button pressed'
  end

end

When the app loads, the AppleRemote instance is listening properly but when
I click on the button my code crashes and here is the bt:

http://gist.github.com/raw/137199/948a2bbe0a45d942977563350a3bf15c27b4ee55/0.5%20with%20bridgesupport

#0  0x00007fff82bc3490 in realizeClass ()
#1  0x00007fff82bc354e in realizeClass ()
#2  0x00007fff82bc354e in realizeClass ()
#3  0x00007fff82bc3d17 in _objc_fixupMessageRef ()
#4  0x00007fff82bc5c7f in objc_msgSend_fixup ()
#5  0x00007fff83bfe587 in __CFMachPortPerform ()
#6  0x00007fff83c202cc in CFRunLoopRunSpecific ()
#7  0x00007fff84582bce in RunCurrentEventLoopInMode ()
#8  0x00007fff84582a04 in ReceiveNextEventCommon ()
#9  0x00007fff845828af in BlockUntilNextEventMatchingListInMode ()
#10 0x00007fff8314e420 in _DPSNextEvent ()
#11 0x00007fff8314dd61 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#12 0x00007fff83147af4 in -[NSApplication run] ()
#13 0x00007fff831148ac in NSApplicationMain ()
#14 0x0000000102880940 in ?? ()


Any help would be much appreciated.

Thanks,

- Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090629/9dfd4611/attachment.html>


More information about the MacRuby-devel mailing list