iOS有“Notification Listener”吗?

是否有可能在iOS中创build通知监听器? 就像Android中NotificationListenerService

编辑:我想要做的是听任何来自设备内的任何应用程序的通知(未接电话,电子邮件,短信…)

有两个可能的答案。

NSNotificationCenter用于在应用程序本身发布通知。 举例来说,你想要几个class级都接收信息,发生了什么(或什么),那么你会用这个。 https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/nsnotificationcenter_Class/Reference/Reference.html

如果你的意思是Remote Notifications即从苹果公司收到的推送通知,那么AppDelegate会通过一些方法接收这些通知。

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

编辑:这是不可能的应用程序之间。 看评论。