mardi 19 juillet 2016

Push notification actions not showing in Swift?

I currently have an iOS project but the push notification actions aren't showing. Here is the payload body I'm testing it with:

$body['aps'] = array(
  'alert' => $message,
  'sound' => 'default',
  'link_url' => $url,
  'category' => 'NEWS_CATEGORY',
  );

Here is the registerForPushNotifications in App Delegate:

func registerForPushNotifications(application: UIApplication) {

//allows notification actions by setting catagories
let viewAction = UIMutableUserNotificationAction()
viewAction.identifier = "VIEW_IDENTIFIER"
viewAction.title = "View"
viewAction.activationMode = .Foreground

let newsCategory = UIMutableUserNotificationCategory()
newsCategory.identifier = "NEWS_CATEGORY"
newsCategory.setActions([viewAction], forContext: .Default)

let notificationSettings = UIUserNotificationSettings(forTypes: [.Badge, .Sound, .Alert], categories: [newsCategory])

}

Any help on why the notification actions aren't showing is greatly appreciated!

Aucun commentaire:

Enregistrer un commentaire