On 3/21/06, Jonathan Paisley <jp-www@dcs.gla.ac.uk> wrote:
Hi,

I cc-ed this reply back to the list. I hope that's okay.

Not a problem, I'm glad to share.

> I should have said that it would not build (instead of not
> compile).  I tried both ways to call compositeToPoint that you
> suggested and they both failed to build.  Here is the error:

I think the project has built successfully. What you're seeing is a
run time error (which shows up in the Run Log window in XCode).

> ../MapView.rb:31:in `NSApplicationMain': NSApplicationMain -
> RBException_NoMethodError - undefined method `compositeToPoint' for
> nil:NilClass (OSX::OCException)
>
> or
>
> ../MapView.rb:32:in `NSApplicationMain': NSApplicationMain -
> RBException_NoMethodError - undefined method
> `compositeToPoint_operation' for nil:NilClass (OSX::OCException)
>
> Does this mean that @mapbase is not getting initialized in
> initWithFrame?  I'm just not familiar enough with Cocoa to debug this.

Precisely. Add some 'puts' to your initWithFrame method to ensure it
gets called. I suspect that the image you're asking for:

     @mapbase = NSImage.imageNamed("map_blank")

cannot be found. The method returns nil on failure.

Check that your image has been copied to the built application's
Resources directory. You should have a directory called 'build' next
to the Xcode project. In there should be either be YourProject.app,
or it'll be inside a directory called 'Development' or 'Deployment',
depending on your current build settings.

Navigate inside the application bundle (the *.app directory) at the
terminal or in the Finder by control-clicking and choosing 'Show
package contents'.

That did it.  I added the image file to my project and it works.  Thanks again.

-Matt
--
haazmatt@gmail.com