![](/img/trans.png)
[英]How to play music if any silent push fired in background mode in iOS?
[英]iOS Twin Push SDK Lib showNotification not fired
我正在使用TwinPushSDK来使用Swift语言接收通知。
http://developers.twinpush.com/developers/ios?class=sidebar-header#twinpush-sdk-library
一切正常,但显示通知时我需要接收事件。
我的AppDelegate扩展了TwinPushManagerDelegate,正如我在文档中所解释的,我必须实现showNotification
From SDK
该控制器后,您必须覆盖默认行为以阻止TwinPush显示默认查看器。 为此,只需在应用程序委托中实现在TwinPushManagerDelegate中声明的showNotification方法,并显示视图控制器即可。 例如:
这是我的AppDelegate
class AppDelegate: UIResponder, UIApplicationDelate, TwinPushManagerDelegate{
....
....
....
// Swift
// MARK: TwinPushManagerDelegate
func showNotification(notification: TPNotification!) {
// Only show content viewer for rich notifications
doWhatever()
}
}
http://developers.twinpush.com/developers/ios?class=sidebar-header#custom-rich-notification-viewer
这永远不会被触发,我需要控制它,我可以在lib类中停止它,但不能在我的委托中停止它
我错过了什么吗?
谢谢你的帮助
从Objective-C生成的自动Swift签名现在在方法名称中不包含参数名称,请尝试以下签名:
func show(_ notification: TPNotification!) {
doWhatever()
}
XCode应该能够使用正确的签名自动完成,以防其他任何更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.