このページのリンゴの例のコードを使用しました:リンク、しかし、音を繰り返すことができないようです。skype (VOIP 用) や Alarm Clock Pro (オーディオ?) などの他のアプリケーションを確認しましたが、サウンド ファイルを繰り返すことができません。
これは私のコードです:
- (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];
}
}
}
これを修正する方法について何か提案はありますか?
アプリをオーディオ プレーヤーとして登録し、バックグラウンドでサウンドを再生するという提案がありましたが、実際のオーディオ プレーヤーではないため、Apple はこれらのアプリケーションに親切に対応しているようです。したがって、彼らはそれらのアプリを拒否します。
よろしく、
ポール・ピーレン