objective c - NSUserNotificationCenter defaultNotificationcenter returns nil -


i feel going insane here.

i'm making little command-line tool let me know when twitch channel goes live. far, works. there's one, small issue: [nsusernotificationcenter defaultusernotificationcenter] consistently returning nil, no matter call in program. bit of problem, since need able send notifications.

after solid hour of googling, can't figure out what's going on. [[nsusernotificationcenter defaultusernotificationcenter] setdelegate:mydelegate] doesn't crash, i'm pretty sure that's because can send messages nil in obj-c. similarly, can [[nsusernotificationcenter defaultnotificationcenter] delivernotification: mynote], nothing displayed onscreen (and delegate [nsusernotificationcenter defaultusernotificationcenter] set return yes usernotificationcenter:(nsusernotificationcenter *)center shouldpresentnotification:(nsusernotification *)method.)

additionally, notifications presented via delivernotification not have delivered property set yes.

the thing can think of usage of nsusernotificationcenter works if you're running nsapplication, cannot find documented anywhere. i'm running simple command-line tool, pretty main function, @autoreleasepool, , method calls.

is there obvious can cause [nsusernotificationcenter defaultusernotificationcenter] return nil?

the thing can think of usage of nsusernotificationcenter works if you're running nsapplication, cannot find documented anywhere.

i don't think easy find explicitly documented somewhere, if app simple command line tool, i.e., not using nsrunloop, doubt features notifications can work @ all. intrinsically require program have run loop sits there waiting events (e.g., notification coming in, click, touch) , dispatching them whomever should handle them.

you might try starting , nsrunloop main function, cease simple command-line tool, guess.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -