ios8 - ios 8 interactive notifications not showing actions -
this code register interactive notifications ios8 :
+ (void)registerinteractivenotifications { uimutableusernotificationcategory *corideinvitecategory = [self corideinvitecategory]; uimutableusernotificationcategory *riderinvitecategory = [self riderinvitecategory]; nsset *categories = [nsset setwithobjects:corideinvitecategory, riderinvitecategory, nil]; uiusernotificationtype types = (uiusernotificationtypealert| uiusernotificationtypesound| uiusernotificationtypebadge); uiusernotificationsettings *settings; settings = [uiusernotificationsettings settingsfortypes:types categories:categories]; [[uiapplication sharedapplication] registerusernotificationsettings:settings]; } + (uimutableusernotificationcategory *)riderinvitecategory { uimutableusernotificationaction *accept; accept = [[uimutableusernotificationaction alloc] init]; [accept setactivationmode:uiusernotificationactivationmodeforeground]; [accept settitle:@"accept"]; [accept setidentifier:riderinviteaccept]; [accept setdestructive:no]; [accept setauthenticationrequired:no]; uimutableusernotificationaction *decline; decline = [[uimutableusernotificationaction alloc] init]; [decline setactivationmode:uiusernotificationactivationmodeforeground]; [decline settitle:@"decline"]; [decline setidentifier:riderinvitedecline]; [decline setdestructive:yes]; [decline setauthenticationrequired:no]; uimutableusernotificationcategory *actioncategory; actioncategory = [[uimutableusernotificationcategory alloc] init]; [actioncategory setidentifier:riderinvitecategory]; [actioncategory setactions:@[decline, accept] forcontext:uiusernotificationactioncontextdefault]; [actioncategory setactions:@[decline, accept] forcontext:uiusernotificationactioncontextminimal]; return actioncategory; } + (uimutableusernotificationcategory *)corideinvitecategory { uimutableusernotificationaction *accept; accept = [[uimutableusernotificationaction alloc] init]; [accept setactivationmode:uiusernotificationactivationmodeforeground]; [accept settitle:@"accept"]; [accept setidentifier:corideinviteaccept]; [accept setdestructive:no]; [accept setauthenticationrequired:no]; uimutableusernotificationaction *decline; decline = [[uimutableusernotificationaction alloc] init]; [decline setactivationmode:uiusernotificationactivationmodeforeground]; [decline settitle:@"decline"]; [decline setidentifier:corideinvitedecline]; [decline setdestructive:yes]; [decline setauthenticationrequired:no]; uimutableusernotificationcategory *actioncategory; actioncategory = [[uimutableusernotificationcategory alloc] init]; [actioncategory setidentifier:corideinvitecategory]; [actioncategory setactions:@[decline, accept] forcontext:uiusernotificationactioncontextdefault]; [actioncategory setactions:@[decline, accept] forcontext:uiusernotificationactioncontextminimal]; return actioncategory; }
what happens : when delete app , install again, 2 action buttons (when pull down notification banner, or swipe left in notification center) appears. after while ( i'm not sure cause ), stop appearing although keep sending same notification. notification content:
{"aps":{"alert":"test","category":"coride_invite"},"journey_id":100}
can shed light please ? thanks
check following in code if anywhere else well:
[[uiapplication sharedapplication] registerusernotificationsettings:settings];
since, uiusernotificationsettings
singleton, whenever call this, overwrites old settings. if new settings registered without buttons not show buttons.
better way of registering new setting explained here: interactive push notifications - hide/show buttons