【发布时间】:2014-06-10 11:57:00
【问题描述】:
我的应用程序有一个问题,当收到警报本地通知时,声音没有在 iPhone 4s (iOS 7)(手机已锁定) 中播放,但在 iPod(ios 6.1. 6) 和 iPhone 5(iOS 8)。我使用以下代码..
// Schedule the notification
UILocalNotification* localNotification = [[UILocalNotification alloc]init];
localNotification.fireDate = itemDate;
NSLog(@"%@",index);
if (appDelegate().check == 0) {
[self repetationType:index Notification:localNotification];
}
//setting repetation type
//UILocalNotificationDefaultSoundName
localNotification.soundName=@"Message Alert - Happy.wav";
NSString *str=[NSString stringWithString:NSLocalizedString(@"youhave", nil)];
localNotification.alertBody=[NSString stringWithFormat:@"%@ %@",str,reminName];//remindtext;
NSLog(@"%@",localNotification.alertBody);
localNotification.alertAction = NSLocalizedString(@"item", nil);
localNotification.timeZone = [NSTimeZone defaultTimeZone];
// localNotification.applicationIconBadgeNumber=[[UIApplication sharedApplication]applicationIconBadgeNumber]+1;
localNotification.applicationIconBadgeNumber=1;
NSString *alarm=[[NSString alloc]initWithFormat:@"%@",reminName];
// NSDictionary *userDict=[NSDictionary dictionaryWithObjectsAndKeys:image,@"info",nil];
NSDictionary *userDict = [NSDictionary dictionaryWithObject:alarm forKey:@"info"];
NSLog(@"userDict=%@",userDict);
localNotification.userInfo=userDict;
[[UIApplication sharedApplication]scheduleLocalNotification:localNotification];
【问题讨论】:
标签: ios iphone objective-c