Ответ 1
Вам нужно войти в runloop, используя CFRunLoop или NSRunLoop.
Try:
[[NSRunLoop currentRunLoop] run];
Как будет работать инструмент командной строки навсегда.
Это мой код:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
[[NSDistributedNotificationCenter defaultCenter] addObserverForName:nil object:nil queue:nil usingBlock:^(NSNotification *notification)
{
NSLog(@"%@", notification);
}];
//Keep alive...
}
return 0;
}
Вам нужно войти в runloop, используя CFRunLoop или NSRunLoop.
Try:
[[NSRunLoop currentRunLoop] run];
В Swift 4,
RunLoop.current.run()
Приветствия.