-2

I am receiving an error that 'release' is unavailable: not available in automatic reference mode.

I have tried to google it but without luck.

- (void)awakeFromNib {

    statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] release];

    NSBundle *bundle = [NSBundle mainBundle];

    statusImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"foto1" ofType:@"png"]];
    statusHighlightImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"foto1" ofType:@"png"]];

    [statusItem setImage:statusImage];
    [statusItem setAlternateImage:statusHighlightImage];
    [statusItem setMenu:statusMenu];
    [statusItem setToolTip:@"Hejsa"];
    [statusItem setHighlightMode:YES];

}
Degustaf
  • 2,655
  • 2
  • 16
  • 27

1 Answers1

0

When using automatic reference counting (ARC), release statements are not necessary (the compiler handles memory management for you). You can just delete that call to release in the first line of awakeFromNib.

mipadi
  • 398,885
  • 90
  • 523
  • 479