iOS 有“通知侦听器"吗? [英] Does iOS have a 'Notification Listener'?

查看:17
本文介绍了iOS 有“通知侦听器"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 iOS 中创建通知侦听器?类似于 NotificationListenerService安卓.

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...)

推荐答案

对此有两种可能的答案.

There are two possible answer for this.

NSNotificationCenter 用于在应用程序本身内发布通知.例如,假设您希望多个类都接收发生了某事(或某事)的信息,那么您将使用它.https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/nsnotificationcenter_Class/Reference/Reference.html

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

如果您的意思是 Remote Notifications,即您从 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...

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

在应用之间是不可能的.查看评论.

It's not possible between apps. See comments.

这篇关于iOS 有“通知侦听器"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆