gpt4 book ai didi

objective-c - iOS5本地通知自定义声音Xcode iOS iPhone Objective-C Xcode

转载 作者:行者123 更新时间:2023-12-02 22:43:54 26 4
gpt4 key购买 nike

我正在尝试设置自定义本地通知声音,如下所示:

UILocalNotification *notification = [UILocalNotification new];
notification.timeZone = [NSTimeZone systemTimeZone];
notification.fireDate = date;

notification.alertAction = @"123";
notification.alertBody = @"123";

//!!!
notification.soundName = @"Glass.aiff";

alarmID=[NSString stringWithFormat:@"%i", arrayAlarms.count];
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:alarmID forKey:@"id"];
notification.userInfo = infoDict;
notification.repeatInterval=NSWeekCalendarUnit;

[[UIApplication sharedApplication] scheduleLocalNotification:notification];

但是我只听到默认声音。我正在ios5上测试应用程序。非常感谢您的事先帮助,对不起我的英语。

最佳答案

自定义通知声音被限制在30秒以内。如果您的声音长于此iOS,则会播放默认声音。这可能是您的问题吗?

有关更多信息,请参见此处。 https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html

“自定义声音在播放时必须在30秒之内。如果自定义声音超出该限制,则会播放默认的系统声音。”

关于objective-c - iOS5本地通知自定义声音Xcode iOS iPhone Objective-C Xcode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9709435/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com