diff --git a/example/ios/Notifications/NotificationService.swift b/example/ios/Notifications/NotificationService.swift index e7418cdb..c264de5d 100644 --- a/example/ios/Notifications/NotificationService.swift +++ b/example/ios/Notifications/NotificationService.swift @@ -32,7 +32,7 @@ final class NotificationService: UNNotificationServiceExtension { return } - Client.shared.message(withId: messageId) { res in + Client.shared.message(withId: messageId) { [weak self] res in if let message = res.value?.message, let channel = res.value?.channel { let messageWrapper = MessageWrapper(channel: channel, message: message) @@ -42,8 +42,8 @@ final class NotificationService: UNNotificationServiceExtension { sharedDefaults.setValue(storedMessages + [encodedString], forKey: "messageQueue") // Modify the notification content here... - self.bestAttemptContent?.title = "[modified] \(self.bestAttemptContent?.title ?? "")" - contentHandler(self.bestAttemptContent ?? request.content) + self.bestAttemptContent?.title = "[modified] \(self?.bestAttemptContent?.title ?? "")" + contentHandler(self?.bestAttemptContent ?? request.content) } Client.shared.disconnect() }