Just add one key value pair in your payload
For Example :
{
"aps": {
"alert": "nickname001 just liked you!",
"badge": 2
},
"action": 1
}
Then when receive push notification, just check and follow your requirement.
NSInteger page = [[userInfo objectForKey:@"action"] integerValue];
switch (page) {
case 1:
{
//Update tab A - type A
}
break;
case 2:
{
//Update tab B - type B
}
break;
default:
break;
Also you can do it by nested keys and nested switch-case
respectively…like :
{
"aps": {
"alert": "nickname001 just liked you!",
"badge": 2
},
"action": {
"tab": 1,
"type": "A"
}
}
and respectively
NSInteger page = [[[userInfo objectForKey:@“action”] objectForKey:@“tab”] integerValue];
switch (page) {
case 1:
{
NSString *strType = [[[userInfo objectForKey:@"action"] objectForKey:@"type"] uppercaseString];
if ([strType isEqualToString:@"A"]) {
// update type A
}
else {
// update type B
}
}
break;
case 2:
{
}
break;
default:
break;