iOS Twin Push SDK Lib showNotification未触发

时间:2019-01-15 09:39:14

标签: ios swift

我正在使用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类中停止它,但不能在我的委托中停止它

我想念东西吗?

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

从Objective-C生成的自动Swift签名现在在方法名称中不包含参数名称,请尝试以下签名:

func show(_ notification: TPNotification!) {
    doWhatever()
}

如果其他任何更改,XCode应该能够使用正确的签名自动完成。