Local notification sound does not work

IPhone application

I set a local notification.

I am customizing the sound.

I could not hear any sound when a notification arrives. Even the default sound.

Not on my iPod touch, nor on my device.

Can any body help me figure out the reasons?

Many thanks.

here is the code.

UILocalNotification *localNotification = [[UILocalNotification alloc] init];

localNotification.fireDate=[dateFormat dateFromString:alarm_date];

localNotification.alertBody = @"Alarm.";

localNotification.soundName = [filePath lastPathComponent];

//localNotification.soundName =soundname; 
//UILocalNotificationDefaultSoundName;

localNotification.applicationIconBadgeNumber = 1;

localNotification.alertAction=@"Show";


[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

[localNotification release];

Answer Received Silly Point: Notification sound is played only when your application is in the background or closed. Sorry for this question. Thanks anyway.

+5
source share
2 answers

sound should be less than 30 seconds to play as notification sound

other:

Apple Developer, "aiff", "caf" "wav".

+2

, ...

    UILocalNotification *localNotification = [[UILocalNotification alloc] init];

    localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:5];

    localNotification.timeZone = [NSTimeZone defaultTimeZone];
    localNotification.alertBody = @"You have long time to care your......";
    localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber]+1;
    localNotification.soundName = UILocalNotificationDefaultSoundName;
    localNotification.repeatInterval = kCFCalendarUnitMinute;
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
    [localNotification release];
    localNotification = nil;
+2

All Articles