简体   繁体   中英

How to set image on Apple Watch notification?

Is there any process to set the image on Apple watch notification.? I have tried adding in the image assets but did not find any clue.

I've noticed that there really is a possibility to embed additional image in notification payload which is displayed by Watch (but not iPhone/iPad).

Somehow Pushover guys managed to do this.

嵌入图像的推送通知

But I don't know how they did it. If I would get to know this I will post in answer edit.

Maybe you could ask them? (and post your conclusions here)

In order to display an image from a payload (via a URL, I assume) in a notification, you'll need to create a subclass of WKUserNotificationInterfaceController , which Apple provides as a way to display dynamic notifications.

Although originally written for Swift 1.2, the tutorial at this link can show you how this can be done:

http://www.brianjcoleman.com/tutorial-building-a-apple-watch-notification/

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