0
我有一個問題與我的應用程序,當收到警報本地通知聲音不玩iPhone 4s(iOS 7)(手機被鎖定)但在工作iPod ios 6.1.6)和iPhone 5(iOS 8)。我用下面的代碼..本地通知聲音沒有在iPhone 4S與iOS7中玩
// 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
[email protected]"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];
keyur我添加自定義sound..like localNotification.soundName = @ 「消息提示 - Happy.wav」; – Rahul
@ user3725874確保聲音確實存在於您的應用程序包中,格式正確(線性PCM或IMA4-幾乎任何地方,說明如何爲iOS轉換聲音會告訴您如何做到這一點),並且在30秒內。 – kb920
是的,我添加在應用程序的包中的文件,它是播放的iPod和iPhone 5,但不能在iphone 4s播放 – Rahul