Can I test local notifications on the WatchOS 2 simulator?

I understand a lot to learn how to check local notifications on the WatchOS simulator because I don't have iWatch. Now I have implemented a local notification, but for some reason the notification is displayed on the iPhone simulator, but not on the iWatch simulator (WatchOS 2).

I added the following code in applicationDidFinishLaunchingWithOptions:

UIMutableUserNotificationAction *action1;
    action1 = [[UIMutableUserNotificationAction alloc] init];
    [action1 setActivationMode:UIUserNotificationActivationModeBackground];
    [action1 setTitle:@"Action 1"];
    [action1 setIdentifier:kAction1];
    [action1 setDestructive:NO];
    [action1 setAuthenticationRequired:NO];

    UIMutableUserNotificationAction *action2;
    action2 = [[UIMutableUserNotificationAction alloc] init];
    [action2 setActivationMode:UIUserNotificationActivationModeBackground];
    [action2 setTitle:@"Action 2"];
    [action2 setIdentifier:kAction2];
    [action2 setDestructive:NO];
    [action2 setAuthenticationRequired:NO];

    UIMutableUserNotificationCategory *actionCategory;
    actionCategory = [[UIMutableUserNotificationCategory alloc] init];
    [actionCategory setIdentifier:kAction3];
    [actionCategory setActions:@[action1, action2]
                    forContext:UIUserNotificationActionContextDefault];

    NSSet *categories = [NSSet setWithObject:actionCategory];
    UIUserNotificationType types = (UIUserNotificationTypeAlert|
                                    UIUserNotificationTypeSound|
                                    UIUserNotificationTypeBadge);

    UIUserNotificationSettings *settings;
    settings = [UIUserNotificationSettings settingsForTypes:types
                                                 categories:categories];

    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

Could you receive notifications for local WatchOS notifications in the simulator?

0
source share
2 answers

watch , iPhone notification iPhone, , , , watch . , .

+2

, Watch UILocalNotification. , push-, , .

: : fooobar.com/questions/311865/...

0

All Articles