cocoa and iphoto export

M

mikkel

Hello,

I dont know if this is the right place for this, but Im having some
problems wrapping my head around cocoa and ruby...

Im trying to build a iPhotoExport plugin, using the tutorial
http://cuboidal.org/computers/mac/iphoto/exportplugins/

But instead of implementing the ExampleExport class in obj-c, I want to
do this in ruby.
So I have made a Controller (in Controller.rb) add the outlets and
wired it all up in interface builder...

But when I try to run the exporter i get:
*** -[ExampleBox initWithExportImageObj:]: selector not recognized
[self = 0x6273cb0]

Now, being a cocoa/xcode newbie, I get the impression that I need to
implement the - (id)initWithExportImageObj:(id)fp8 from ExampleExport.m
As far as I know, thats a constructor?? How would I implement this in
my ruby class??

Is it even possible to do what Im trying to do???

thanks in advance

Mikkel
 
T

Terje Tjervaag

But when I try to run the exporter i get:
*** -[ExampleBox initWithExportImageObj:]: selector not recognized
[self =3D 0x6273cb0]

Now, being a cocoa/xcode newbie, I get the impression that I need to
implement the - (id)initWithExportImageObj:(id)fp8 from ExampleExport.m
As far as I know, thats a constructor?? How would I implement this in
my ruby class??

Not having tried the example (thanks for the tip, looks interesting),
and not being at my Mac, I can't say for sure, but from your error,
and in particular the casing of it, I'd guess you haven't called alloc
anywhere. Cocoa objects are typically instantiated, then initialized.
The instantiating is done by the alloc message, and then you send
init[...] to actually initialize your instance. Most often, these two
are called together:
exampleBox =3D [[ExampleBox alloc] initWithExportImageObj:anObj];

In ruby, this probably becomes:
exampleBox =3D ExampleBox.alloc.initWithExportImageObj(anObj)

hope this helps,
 
T

Terje Tjervaag

But when I try to run the exporter i get:
*** -[ExampleBox initWithExportImageObj:]: selector not recognized
[self =3D 0x6273cb0]

Now, being a cocoa/xcode newbie, I get the impression that I need to
implement the - (id)initWithExportImageObj:(id)fp8 from ExampleExport.m
As far as I know, thats a constructor?? How would I implement this in
my ruby class??

Not having tried the example (thanks for the tip, looks interesting) I
can't say for sure, but from your error, and in particular the casing
of it, I'd guess you haven't called alloc anywhere. Cocoa objects are
typically instantiated, then initialized. The instantiating is done
by the alloc message, and then you send init[...] to actually
initialize your instance. Most often, these two are called together:
exampleBox =3D [[ExampleBox alloc] initWithExportImageObj:anObj];

In ruby, this probably becomes:
exampleBox =3D ExampleBox.alloc.initWithExportImageObj(anObj)

hope this helps,
 
M

mikkel

thanks...
but as far as I can see, my code shouldn't init the examplebox...
Browsing through the ojb-c files the only .nib interaction I see is:

- (id)initWithExportImageObj:(id)fp8 {
if(self = [super init]) {
exportManager = fp8;
[NSBundle loadNibNamed: @"ExampleExport" owner:self];
}
return self;
}

Btw: How can I use NSLog in ruby???

thanks again

Mikkel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top