React National IOS Firebase Messaging ImageNotification are not loaded when the application in the background or killed

37 views Asked by At

I'm trying to download the image to the IOS notification using my Push API. The image inside is loaded, which means that the problem is not with the server. But when I close the application or leave it in the background, the image does not load, just a notification comes.

I followed the React Native Firebase documentation and added everything I needed

target 'ImageNotification' do
    pod 'Firebase/Messaging', '~> 10.21.0'
end

This is added in the ImageNotification.m file

#import "NotificationService.h"
#import "FirebaseMessaging.h"

@interface NotificationService ()

@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;

@end

@implementation NotificationService

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];
    
  [[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent withContentHandler:contentHandler];

}

- (void)serviceExtensionTimeWillExpire {
    self.contentHandler(self.bestAttemptContent);
}

@end

"react-native": "0.72.4", ios 17.2

Pods with Firebase

PODS:
  - boost (1.76.0)
  - CocoaAsyncSocket (7.6.5)
  - DoubleConversion (1.1.6)
  - FBLazyVector (0.72.4)
  - FBReactNativeSpec (0.72.4):
    - RCT-Folly (= 2021.07.22.00)
    - RCTRequired (= 0.72.4)
    - RCTTypeSafety (= 0.72.4)
    - React-Core (= 0.72.4)
    - React-jsi (= 0.72.4)
    - ReactCommon/turbomodule/core (= 0.72.4)
  - Firebase (10.21.0):
    - Firebase/Core (= 10.21.0)
  - Firebase/Core (10.21.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (~> 10.21.0)
  - Firebase/CoreOnly (10.21.0):
    - FirebaseCore (= 10.21.0)
  - Firebase/Messaging (10.21.0):
    - Firebase/CoreOnly
    - FirebaseMessaging (~> 10.21.0)
  - FirebaseAnalytics (10.21.0):
    - FirebaseAnalytics/AdIdSupport (= 10.21.0)
    - FirebaseCore (~> 10.0)
    - FirebaseInstallations (~> 10.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.11)
    - GoogleUtilities/MethodSwizzler (~> 7.11)
    - GoogleUtilities/Network (~> 7.11)
    - "GoogleUtilities/NSData+zlib (~> 7.11)"
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - FirebaseAnalytics/AdIdSupport (10.21.0):
    - FirebaseCore (~> 10.0)
    - FirebaseInstallations (~> 10.0)
    - GoogleAppMeasurement (= 10.21.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.11)
    - GoogleUtilities/MethodSwizzler (~> 7.11)
    - GoogleUtilities/Network (~> 7.11)
    - "GoogleUtilities/NSData+zlib (~> 7.11)"
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - FirebaseCore (10.21.0):
    - FirebaseCoreInternal (~> 10.0)
    - GoogleUtilities/Environment (~> 7.12)
    - GoogleUtilities/Logger (~> 7.12)
  - FirebaseCoreExtension (10.21.0):
    - FirebaseCore (~> 10.0)
  - FirebaseCoreInternal (10.21.0):
    - "GoogleUtilities/NSData+zlib (~> 7.8)"
  - FirebaseInstallations (10.21.0):
    - FirebaseCore (~> 10.0)
    - GoogleUtilities/Environment (~> 7.8)
    - GoogleUtilities/UserDefaults (~> 7.8)
    - PromisesObjC (~> 2.1)
  - FirebaseMessaging (10.21.0):
    - FirebaseCore (~> 10.0)
    - FirebaseInstallations (~> 10.0)
    - GoogleDataTransport (~> 9.3)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.8)
    - GoogleUtilities/Environment (~> 7.8)
    - GoogleUtilities/Reachability (~> 7.8)
    - GoogleUtilities/UserDefaults (~> 7.8)
    - nanopb (< 2.30910.0, >= 2.30908.0)

If I forgot something or the problem is really in the library, then tell me

0

There are 0 answers