【问题标题】:Can a local notification only vibrate the apple watch and not play a sound?本地通知可以只震动apple watch而不播放声音吗?
【发布时间】:2016-04-24 03:45:58
【问题描述】:

我想在手机上安排本地通知。当手机锁定并且手表处于睡眠状态时,我希望通知振动手表但不播放声音。这可能吗?我下面的代码在 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];

【问题讨论】:

    标签: ios notifications watchkit


    【解决方案1】:

    您可以决定不设置声音名称,也不选择在通知设置中使用声音。然后,如果还没有振动行为,您可以制作自己的振动行为。

    【讨论】:

    • 只在手机发送通知时有效。它在手表上不起作用。手表默认为特定的声音和触觉反馈
    猜你喜欢
    • 1970-01-01
    • 2023-04-08
    • 2015-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多