WatchKit Notification Sash Color

2019-04-29 01:29发布

问题:

I've set my notification sash color in storyboard and it works fine in the simulator, but it shows up as gray on my watch. Does anyone know if this is a known issue or do you need to do something at runtime on a real device to show the color properly?

回答1:

The sash color is set for the WKNotificationCategory in the storyboard, which has a name. (In your screenshot "myCategory"). Then, for the correct sash color to appear on the real device, the push notification needs to have the matching category name when you send it.

UILocalNotification *notification = [[UILocalNotification alloc] init];
if (notification) {
    notification.alertBody = @"Hello";
    notification.category = @"myCategory";
    [[UIApplication sharedApplication] scheduleLocalNotification:notification];
}


标签: ios watchkit