iOS 푸시 메시지 이미지 첨부
1





2

3
import UserNotifications
import Hackle
class NotificationService: UNNotificationServiceExtension {
var defaultNotificationContent: UNNotificationContent?
var contentHandler: ((UNNotificationContent) -> Void)?
override func didReceive(
_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
) {
self.defaultNotificationContent = request.content
self.contentHandler = contentHandler
if Hackle.handleRichNotification(request: request, contentHandler: contentHandler) {
return
}
contentHandler(request.content)
}
override func serviceExtensionTimeWillExpire() {
if let contentHandler = contentHandler,
let defaultNotificationContent = defaultNotificationContent {
contentHandler(defaultNotificationContent)
}
}
}마지막 업데이트