How to send a push notification to Apple Watch?

I just configured WatchKit in my project on iPhone devices. Push notification while working properly, currently my requirement sends push notifications to Watch also through server ...

I'm currently trying to get a notification from the payload (static), I want to do this from the server, can anyone help me?

- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void(^)(WKUserNotificationInterfaceType interface)) completionHandler {

       NSDictionary* apsDict = [remoteNotification objectForKey:apsKeyString];

       NSString* titleString = [apsDict objectForKey:titleKeyString];
       [self.titleLabel setText:titleString];

       completionHandler(WKUserNotificationInterfaceTypeCustom);
}
+4
source share
1 answer

When one of your applications receives local or remote notifications on iPhone users, iOS decides whether to display this notification on iPhone or on Apple Watch.

So you don’t have to worry about sending notifications to Watch, iOS will do it for you

, .

Apple Watch Notification Essentials Helping by Apple .

, , ( ) push- Watch

+2

Source: https://habr.com/ru/post/1599272/


All Articles