0
我試圖用聲音在本地通知目標c代碼,但我無法獲得聲音。我的通知即將到來,但聲音無效。打開通知聲音不工作,但通知即將到來
UIUserNotificationType types = UIUserNotificationTypeBadge |
UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *mySettings =
[UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody=msg;
localNotif.alertAction = NSLocalizedString(@"View Details", nil);
localNotif.soundName = UILocalNotificationDefaultSoundName;
//[email protected]"sound.caf";
localNotif.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
是你的iPhone在靜音模式:P – 2014-11-25 07:40:44
沒有我的iPhone不處於靜音模式。 – 2014-11-25 09:03:22
然後進入設置並檢查聲音是否打開,以便推送您的應用程序... – 2014-11-25 13:07:49