【发布时间】:2016-12-22 05:30:10
【问题描述】:
我是 Xcode 和 Swift 的新手。我正准备发送带有显示图像的本地通知。我使用 UNNotificationAttachment 附加来自以下代码的图像:
let content = UNMutableNotificationContent()
content.title = "Testing"
content.body = "Testing rich notification"
let attachement = try! UNNotificationAttachment(identifier: "image", url: Bundle.main.url(forResource: "myImg", withExtension: "png")!, options: nil)
content.attachments = [attachement]
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false)
let request = UNNotificationRequest(identifier: "TenSecond", content: content, trigger: trigger) // Schedule the notification.
let center = UNUserNotificationCenter.current()
center.add(request) { (error : Error?) in
if error != nil {}
}
我可以在通知横幅的右侧看到一个缩略图,但它太小了。我想增加缩略图的大小,使通知看起来像这样:
Notification With larger thumbnail
有可能吗?
【问题讨论】:
-
你发现了吗?
-
我也遇到了这个问题。图标很小,尽管源 png 文件足够大
标签: swift notifications ios10