1

このページのリンゴの例のコードを使用しました:リンク、しかし、音を繰り返すことができないようです。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 はこれらのアプリケーションに親切に対応しているようです。したがって、彼らはそれらのアプリを拒否します。

よろしく、
ポール・ピーレン

4

2 に答える 2

4

ローカル通知に対してこれを行う方法はありません。VOIP アプリとして、または個別の API を持つ「バックグラウンド オーディオ」アプリとして登録できます。ただし、このような用途に適した機能を提供していない場合は、却下される可能性が高くなります。

于 2010-09-13T13:55:55.430 に答える
0

はい、これは可能です。ドキュメントには次のように記載されています。

独自のアプリケーションは、最大128の同時通知をスケジュールでき、そのいずれも、指定された間隔で繰り返すように構成できます。

repeatIntervalプロパティを構成する必要があります。

通知を再スケジュールするカレンダー間隔。

于 2010-10-28T05:52:49.187 に答える