简体   繁体   English

iOS Twin Push SDK Lib showNotification未触发

[英]iOS Twin Push SDK Lib showNotification not fired

I am using TwinPushSDK to receive notifications using Swift language. 我正在使用TwinPushSDK来使用Swift语言接收通知。

http://developers.twinpush.com/developers/ios?class=sidebar-header#twinpush-sdk-library http://developers.twinpush.com/developers/ios?class=sidebar-header#twinpush-sdk-library

Everything it's working fine but I need to receive the event when the notification is shown. 一切正常,但显示通知时我需要接收事件。

My AppDelegate extends TwinPushManagerDelegate and as it's explained in the document I have to implement showNotification 我的AppDelegate扩展了TwinPushManagerDelegate,正如我在文档中所解释的,我必须实现showNotification

From SDK Once you have that controller, you have to override the default behavior to stop TwinPush from showing the default viewer. From SDK该控制器后,您必须覆盖默认行为以阻止TwinPush显示默认查看器。 To achieve it, simply implement the method showNotification, declared in TwinPushManagerDelegate, in your application delegate and show your view controller. 为此,只需在应用程序委托中实现在TwinPushManagerDelegate中声明的showNotification方法,并显示视图控制器即可。 For example: 例如:

This is My AppDelegate 这是我的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 http://developers.twinpush.com/developers/ios?class=sidebar-header#custom-rich-notification-viewer

This is never fired and I need to control it, I can stop it inside the lib class but not in my delegate 这永远不会被触发,我需要控制它,我可以在lib类中停止它,但不能在我的委托中停止它

am I missing something? 我错过了什么吗?

Thanks for any help 谢谢你的帮助

The automatic Swift signature generated from Objective-C now doesn't include parameter names in the method name, try with this signature: 从Objective-C生成的自动Swift签名现在在方法名称中不包含参数名称,请尝试以下签名:

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

XCode should be able to auto-complete with the correct signatures in case any other has changed. XCode应该能够使用正确的签名自动完成,以防其他任何更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM