Reputation: 83
I am getting an expression result unused, the cause of this is pretty obvious but I would like to avoid this warning in the cleanest way possible:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[_window setReleasedWhenClosed:TRUE];
[_window close];
[[HotkeyHandler alloc] init:self];
}
HotkeyHandler is another class that basically listens for hotkeys. I just need it to be initialized and that's all it needs to do. I don't use any of its methods since these will be triggered by system notifications. Any ideas on circumventing this warning?
Upvotes: 0
Views: 1438
Reputation: 9944
The problem is that the instance you created will be dealloc'ed once you leave that method, so it won't be able to listen the notifications. Why don't you make that class a singleton?
Upvotes: 1