2

有没有办法在ios中设置LocalNotification的音量。我已经写了这段代码,它工作得很好,但是我没有办法设置本地通知的音量。代码如下:

UILocalNotification *localNotification =[[UILocalNotification alloc]init];

if (localNotification==nil) {
    return;
}

localNotification.fireDate=date;
localNotification.timeZone=[NSTimeZone defaultTimeZone];
localNotification.repeatCalendar=[NSCalendar currentCalendar];
localNotification.alertBody=[NSString stringWithFormat:@"%@",[tmpdict objectForKey:@"Reminder"]];

NSDictionary *snoozeDic=[tmpdict objectForKey:@"Snooze"];
if ([[snoozeDic valueForKey:@"Switch"]intValue]==1) {
    localNotification.alertAction=@"Snooze";
}else
{
    localNotification.hasAction=NO;
}

localNotification.repeatInterval=CalUnit;
localNotification.soundName=[NSString stringWithFormat:@"%@.caf",[tmpdict objectForKey:@"Tone"]];
localNotification.userInfo=[NSDictionary dictionaryWithObject:tmpdict forKey:@"AlarmInfo"];
localNotification.applicationIconBadgeNumber=1;

[[UIApplication sharedApplication]scheduleLocalNotification:localNotification];
4

0 回答 0