Problem with beginSheetForDirectory


I’m building the program outlined in chapters 17 and 18 on 10.6 with Xcode 3.2.5. There seems to be a problem with this function:

  • (IBAction)showOpenPanel:(id)sender
    NSOpenPanel *panel = [NSOpenPanel openPanel];

    // Run the open panel
    [panel beginSheetForDirectory:nil
    types:[NSImage imageFileTypes]
    modalForWindow:[stretchView window]

When I hit file->Open the file selection dialog box comes up but disappears after a second or two. At some point (maybe a second, maybe 30 seconds) the program crashes with:

Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all

Is this a problem with the somewhat later version of OSX and/or Xcode? My code is exactly the same as the code in the book.

I have the 4th edition on order, but since it’s based on Lion and the newest Xcode there may be other problems. I’d like a solution that works with what I’m using…

Thanks for your suggestions!