Hi,guys, I want to use new APNs apis of iOS8 to handle notification actions. In this method:
- (void)application:(UIApplication *)application
handleActionWithIdentifier:(NSString *)identifier
forRemoteNotification:(NSDictionary *)notification
completionHandler:(void (^)())completionHandler {
if ([identifier isEqualToString:@"ACCEPT_IDENTIFIER"]) {
[self handleAcceptActionWithNotification:notification];
}
else if([identifier isEqualToString:@"MAYBE_IDENTIFIER"]) {
[self handleMaybeActionWithNotification:notification];
}
else if ([identifier isEqualToString:@"REJECT_IDENTIFIER"]) {
[self handleRejectActionWithNotification:notification];
}
else if....blah blah blah..
}
In this case, I may have to write too many if-else statements with NSString in the future, and I knew some way to avoid too many if-else statements,such as using switch, but it's not for string or NSString case.
Is it any solution to avoid writing too many if-else statement in this string or NSString case? Thanks in advance.