Does iOS have a 'Notification Listener'?

前端 未结 1 732
挽巷
挽巷 2020-12-18 06:29

Is it possible to create a Notification Listener in iOS? Something like the NotificationListenerService in Android.

Edit: What I want to do

相关标签:
1条回答
  • 2020-12-18 07:15

    There are two possible answer for this.

    NSNotificationCenter is used to post notifications within the app itself. Say for instance you want several classes all to receive information that something has happened (or something) then you would use this. https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/nsnotificationcenter_Class/Reference/Reference.html

    If you mean Remote Notifications i.e. push notifications that you receive from Apple then the AppDelegate receives these in a couple of its methods...

    https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40006786-CH3-SW16

    Edit: It's not possible between apps. See comments.

    0 讨论(0)
提交回复
热议问题