简体   繁体   中英

How to send push notification in Apple Watch?

I just configured WatchKit in my Project, in iPhone devices Push notification working properly, currently my requirement is send Push notification in Watch also through server...

Currently what I have tried is getting Notification from payload (static), I want to do it from server, can anyone help me out?

- (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);
}

When one of your app's local or remote notifications arrives on the user's iPhone, iOS decides whether to display that notification on the iPhone or on the Apple Watch.

So you don't need to worry about to send notification on Watch, iOS will do it for you

Here is the Answer, I already Posted about this .

This thread contains Apple Watch Notification Essentials Helping Link by Apple too.

And yes this is the method you are using (posted in question) to listen push notification in Watch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM