问题描述
我有一个相当大的iOS项目。当应用程序在前台接收到通知时,该通知以类似于AlertView的形式显示。我想摆脱它。我不知道这是我很久以前编程的东西,还是项目中的一个框架(Parse,Onesignal,FBSDK)正在这样做。我的问题是,如何确定警报视图的来源,因此可以删除该代码。我没有在任何地方实现 willPresentNotification
方法(我已经搜索了整个项目)。我确实有一个 didReceiveRemoteNotification
方法,即使只在点击通知时才调用该方法,我还是尝试将其注释掉。我也搜索了整个项目的UIAlertView和UIAlertController,但没有用。
I have a fairly large iOS project. When the app receives a notifications while in the foreground, the notification is displayed in something that looks like an AlertView. I want to get rid of it. I have no idea if this is something I programmed myself a long time ago, or if one of the frameworks in the project (Parse, Onesignal, FBSDK) is doing this. My question is, how can I find out where that alert view is coming from, so I can remove that code. I have not implemented the willPresentNotification
method anywhere (I have searched through the entire project). I do have a didReceiveRemoteNotification
method, and even though that should only be called when a notification is tapped, I have tried commenting it out. I have also searched through the entire project for UIAlertView and UIAlertController, to no avail.
推荐答案
自动使用新的在设备上检测到。
OneSignal SDK automatically uses the new UserNotifications Framework, when iOS10 is detected on device.
在这种情况下,AppDelegate方法方法未调用,而是被调用,由SDK捕获以记录点击/观看次数。
In this case, the AppDelegate method didReceiveRemoteNotification method not get called, instead methods in UNUserNotificationCenterDelegate get invoked, which is captured by SDK to record clicks/views.
OneSignal使用来处理收到的通知。
OneSignal use callback to handle received Notification.
-
OSHandleNotificationReceivedBlock:在应用程序仅在焦点对准时会收到通知
OSHandleNotificationReceivedBlock: Called when the app receives a notification while in focus only
OSHandleNotificationActionBlock:在用户打开或点击通知上的操作时调用。
OSHandleNotificationActionBlock: Called when the user opens or taps an action on a notification.
OSNotificationOpenedResult:用户收到的通知返回的信息。
OSNotificationOpenedResult: The information returned from a notification the user received.
您可以直接实现方法来处理应用程序中与通知相关的交互。
You can directly implement UNUserNotificationCenterDelegate methods to handling notification-related interactions in your app.
这篇关于当iOS应用程序位于前台时忽略推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!