简体   繁体   中英

iOS Twin Push SDK Lib showNotification not fired

I am using TwinPushSDK to receive notifications using Swift language.

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

From SDK Once you have that controller, you have to override the default behavior to stop TwinPush from showing the default viewer. To achieve it, simply implement the method showNotification, declared in TwinPushManagerDelegate, in your application delegate and show your view controller. For example:

This is My 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

This is never fired and I need to control it, I can stop it inside the lib class but not in my delegate

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:

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

XCode should be able to auto-complete with the correct signatures in case any other has changed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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