I try to add action button in notification onesignal react-native ios.So i used apns file for test in simulator, the notification coming with dragging file but action button does not appear even i made a long press can anyone give me the correct aps format json and thinks for help this my payload apns file for test:
{
"Simulator Target Bundle": "******",
"aps": {
"alert": {
"title": "Push Notification",
"subtitle": "Test Push Notifications",
"body": "Testing Push Notifications on iOS Simulator",
"actionButtons":[
{
"id":"test",
"text":"test"
}
]
}
},
"custom": {
"i": "notificationId as UUID",
"a": {"deeplinkKey": "{\"deeplinkDetailKey\":\"deeplinkDetailValue\"}", "launchURL": "example://collection/myCollectionId/type/1"}
}
}
I solved my problem by adding these lines which include the category name and the action button to AppDelegate.m file
// Define notification actions (the buttons)
UNNotificationAction *acceptAction = [UNNotificationAction actionWithIdentifier:@"accept" title:@"Accept" options:UNNotificationActionOptionForeground];
UNNotificationAction *declineAction = [UNNotificationAction actionWithIdentifier:@"ignore" title:@"Decline" options:UNNotificationActionOptionDestructive];
// Define the notification category with the actions
UNNotificationCategory *inviteCategory = [UNNotificationCategory categoryWithIdentifier:@"myapp_action" actions:@[acceptAction, declineAction]
intentIdentifiers:@[] options:UNNotificationCategoryOptionCustomDismissAction];