0

I'm wondering is there a way to get all of the messages in Notification Center.

I already know how to post a message, but I don't know whether I can get the messages posted by other Apps into my App for usage.

Cœur
  • 37,241
  • 25
  • 195
  • 267
albusshin
  • 3,930
  • 3
  • 29
  • 57

2 Answers2

3

No, you cannot access this information from an app

Paulw11
  • 108,386
  • 14
  • 159
  • 186
1

Yes, you can:

CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), nil, { (_, observer, name, _, _) in
        print("Notification \(name) received")
        }, nil, nil, .deliverImmediately)

But be careful, there are a lot of notifications. :-)

Please consider also this SO question.

Community
  • 1
  • 1
Michael Dorner
  • 17,587
  • 13
  • 87
  • 117