-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"MessageReceived" object:self];
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive)
{
// NSString *cancelTitle = @"Close";
NSString *showTitle = @"Show";
// NSString *message = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"New Order"
message:@"You just received new order"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:showTitle, nil];
UILocalNotification *localNotifcation = [[UILocalNotification alloc] init];
localNotifcation.userInfo = userInfo;
localNotifcation.soundName = UILocalNotificationDefaultSoundName;
// localNotifcation.alertBody = message;
localNotifcation.fireDate = [NSDate date];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotifcation];
[alertView show];
}
else {
//Do stuff that you would do if the application was not active
}
}
Please give me a solution how can i get sound when application is running if notification came right now am using x-code 6.3?