UILocalNotification repetir sonido
He usado el código del ejemplo de manzanas de esta página:Enlazar, pero parece que no puedo repetir el sonido. He comprobado otras aplicaciones, como skype (para VOIP) y Alarm Clock Pro (audio?), Pero no puedo repetir el archivo de sonido.
Este es mi código:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
AlarmHandler *AHinstance = getAlarmHandlerInstance();
UIApplication* app = [UIApplication sharedApplication];
NSArray *alarmList = [AHinstance getAlarms];
NSArray *oldNotifications = [app scheduledLocalNotifications];
if ([oldNotifications count] > 0)
{
[app cancelAllLocalNotifications];
}
for (Alarm *theAlarm in alarmList) {
NSDate *alarmDate = [theAlarm getNearestActivationDate];
Package *alarmPackage = [theAlarm getAlarmPackage];
NSArray *fileList = [alarmPackage getVoiceFileListForBackgroundNotificationWithHour:theAlarm.larmHour];
if( alarmDate == nil ) continue;
UILocalNotification* alarm = [[[UILocalNotification alloc] init] autorelease];
if (alarm)
{
NSLog(@"File: %@", [fileList objectAtIndex:0]);
alarm.fireDate = alarmDate;
alarm.timeZone = [NSTimeZone defaultTimeZone];
alarm.soundName = [fileList objectAtIndex:0];
alarm.alertBody = @"Time to wake up!";
alarm.repeatInterval = 0;
[app scheduleLocalNotification:alarm];
}
}
}
¿Alguna sugerencia sobre cómo puedo solucionar esto?
He tenido sugerencias para registrar la aplicación como reproductor de audio y reproducir sonidos en segundo plano, pero parece que Apple toma amablemente esas aplicaciones porque no son reproductores de audio reales. Por lo tanto, niegan esas aplicaciones.
Saludos,
Paul Peelen