I am receiving a push notification and trying to parse the dictionary as follows but I am getting the following exception.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull isEqualToString:]: unrecognized selector sent to instance 0x1a6574ef8'
Here is my received dictionary
Implementation
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
if (application.applicationState == UIApplicationStateActive)
{
// exception happens the following line
if([[userInfo objectForKey:@"aps"] objectForKey:@"alert"] != NULL &&
[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]isEqualToString:@"New Order!"])
{
[[NSNotificationCenter defaultCenter] postNotificationName: @"newOrderNotificationMessage" object: [userInfo objectForKey:@"aps"]];
}
}