I am Googling a lot to find out way to check local notifications on the WatchOS Simulator because I don't have an iWatch. Right now I have implemented local notification but due some reason notification is shown on iPhone simulator but not on iWatch (WatchOS 2) simulator.
I have added 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];
Have you been able to get notifications for WatchOS local notifications in the simulator?
Run your watch app on simulator, from
iPhone
simulator schedule thenotification
and lock theiPhone
simulator screen, keep the watch simulator active, in that case when notification is triggered , it will be delivered on yourwatch
simulator. Same will be the case when you will test on actual devices.