Yes you guess right, NSApplication
don't retain the delegate, (weak reference with ARC).
So you can just build the main.m file with -fno-objc-arc
with you current code :
int main(int argc, char *argv[])
{
@autoreleasepool
{
[NSApplication sharedApplication];
[NSApp setDelegate:[[AppDelegate alloc] init]];
[NSApp finishLaunching];
[NSApp run];
}
}
or set you AppDelegate static in main.m, for example, and build with ARC
static AppDelegate* _appDelegate;
int main(int argc, char *argv[])
{
@autoreleasepool
{
_appDelegate = [[AppDelegate alloc] init];
[NSApplication sharedApplication];
[NSApp setDelegate:_appDelegate];
[NSApp run];
}
}