问题描述
是否可以在iOS中创建通知侦听器?像 NotificationListenerService 中的 Android 。
Is it possible to create a Notification Listener in iOS? Something like the NotificationListenerService in Android.
编辑:我要做的是收听来自设备内任何应用的任何通知(未接来电,电子邮件,短信......)
What I want to do is listen to any notifications coming from any app within the device (missed calls, emails, SMS...)
推荐答案
有两种可能的答案。
NSNotificationCenter
用于在应用程序内发布通知。比方说,你想要几个类都接收到某些事情发生的信息(或者其他什么)然后你会使用它。
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
如果你的意思是远程通知
即推送从Apple收到的通知,然后AppDelegate会通过几种方式接收这些通知......
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...
编辑:应用之间无法实现。见评论。
It's not possible between apps. See comments.
这篇关于iOS有“通知监听器”吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!