カスタムサウンドで動作するように NSUserNotification soundName を作成した人はいますか? 私は aif と caf フォーマット 44100KHz 16bit 2 秒の長さで試しました。通知は適切なタイミングで適切なタイトルとテキストで表示されますが、カスタム サウンドの代わりにデフォルトのサウンドが再生されます。
サウンド ファイルはアプリケーション バンドルに正しくコピーされます。これを試してみると、サウンドは正常に動作します:
NSSound* sound = [NSSound soundNamed:@"morse.aif"];
[sound play];
しかし、通知で同じサウンドを使用すると、デフォルトの通知サウンドが再生されます。
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
NSUserNotification* notification = [[NSUserNotification alloc]init];
notification.title = @"Titolo";
notification.deliveryDate = [NSDate dateWithTimeIntervalSinceNow:10];
notification.soundName = @"morse.aif";
[[NSUserNotificationCenter defaultUserNotificationCenter]scheduleNotification:notification];
}
拡張機能の有無にかかわらず試しましたが、成功しませんでした。
notification.soundName = @"morse.aif";
notification.soundName = @"morse2.caf";
notification.soundName = @"morse";
これらのどれも機能しません。
私のアプリケーションは署名されておらず、サンドボックス化されていませんが、ユーザー通知には必要ないと思います。音の問題は別として、通知はうまく機能します。