相关疑难解决方法(0)

UILocalNotification自定义声音不在iOS7中播放

我正在UILocalNotification申请中使用.

在应用程序中有两种声音有条件地播放 - 我已经为它们应用了适当的条件.

但是当我安装应用程序并在iOS 7设备上运行它时,它会触发本地通知,但声音不会在应用程序中播放.

下面给出了代码来设置通知:

    UILocalNotification *localNotification = [[UILocalNotification alloc] init];
    if (localNotification == nil)
        return;
    localNotification.fireDate = [pickerView date];

    localNotification.timeZone = [NSTimeZone defaultTimeZone];

    if (alarm_number == 1) {
        localNotification.alertBody = [NSString stringWithFormat:@"First Alarm"];
    }
    else
    {
        localNotification.alertBody = [NSString stringWithFormat:@"Second Alarm"];
    }

    localNotification.alertAction =@"Ok";

    NSString *message = [[NSString alloc]initWithString:@""];

    if(alarm_number == 1)
    {
        localNotification.soundName=@"Alarm_1.mp3";
        message = @"First Alarm Scheduled";
    }
    else
    {
        localNotification.soundName=@"Alarm_2.mp3";
        message = @"Second Alarm Scheduled";
    }

    localNotification.applicationIconBadgeNumber = 1;

    // …
Run Code Online (Sandbox Code Playgroud)

iphone audio ios uilocalnotification ios7

16
推荐指数
2
解决办法
1万
查看次数

标签 统计

audio ×1

ios ×1

ios7 ×1

iphone ×1

uilocalnotification ×1