我想在电话上安排本地通知。当手机锁定且手表处于睡眠状态时,我希望通知振动手表但不播放声音。这可能吗?我下面的代码在 iPhone 上运行以安排通知,但不知道如何在手表上播放时抑制声音。
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.fireDate = [[NSDate date] dateByAddingTimeInterval:60];
notification.alertTitle = [NSString stringWithFormat:@"Hi # %d", i];
notification.alertBody = @"Hello!";
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
您可以决定不设置声音名称,也不选择在通知设置中使用声音。如果还没有振动行为,您可以创建自己的振动行为。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)