UNNotificationAttachment with UIImage or Remote URL

后端 未结 4 1421
旧巷少年郎
旧巷少年郎 2020-12-05 15:02

In my Notification Service Extension I am downloading an image from a URL to show as UNNotificationAttachment in a notification.

So I have

4条回答
  •  悲&欢浪女
    2020-12-05 15:19

    From UIImage it seems that it is not possible, all the solutions that I found were downloading the image and store it somewhere locally. Also makes sense because you would have to import UIKit and not sure if it is compatible with extensions (and why import a whole framework when there are simpler solutions).

    Here is a simpler and testable solution and without the need of using a FileManager.

提交回复
热议问题