Screensaver Options Button Not Working

I'm not sure if this is the correct place for this question, so apologies if this belongs somewhere else, just let me know.


I am trying to add a configuration sheet to a screensaver I have developed in XCode 10.1, but after installing the .saver file pressing the "Screen Saver Options" button doesn't open my window, and other tutorials seem to be too far out of date. So far, this is what I have:


I have made a window in Interface Builder called ConfigureSheet.nib

My .m file contains the following relavent code:

- (BOOL)hasConfigureSheet
{
    return YES;
}
- (NSWindow*)configureSheet
{
    NSBundle* configBundle;
    if (configureSheet == nil ) {
        [configBundle loadNibNamed:kConfigSheetNIB owner:self topLevelObjects:nil];
    }
    
    [shouldFadeCheckbox setState: isFading];
    return configureSheet;
}

- (IBAction) cancelSheetAction: (id) sender {
    //  close the sheet without saving the settings
    [NSApp endSheet: configureSheet];
}

- (IBAction) okSheetAction: (id) sender {
    //  record the settings in the configuration sheet
    isFading = [shouldFadeCheckbox state];
    [NSApp endSheet: configureSheet];
}

My .h file contains the following relavent code:

#import 
#define kConfigSheetNIB @"ConfigureSheet"
@interface My_ScreensaverView: ScreenSaverView {
    IBOutlet NSWindow* configureSheet;
    IBOutlet id shouldFadeCheckbox;
    BOOL isFading;
     [all of my initialized variables]
}
- (IBAction) cancelSheetAction: (id) sender;
- (IBAction) okSheetAction: (id) sender;

@end


Can anyone help?

Replies

Suggest a few NSLogs and error checks, which may help, although at first glance all looks reasonable. Here is what my code looks like:


- (NSWindow*)configureSheet {
    
    if (  ! self.configSheet) {
        
        if ( ! [[NSBundle bundleForClass:[self class]] loadNibNamed:@"ConfigureSheet" owner:self  topLevelObjects:nil] ) {
            NSLog( @"Failed to load configure sheet." );
            NSBeep();
        }
     }
        
   ...

    return self.configSheet;
}

Well, on second thought your code fails because variable configBundle is NIL.