![](/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.