Expo notification doesn't work on iOS

Please provide the following:

  1. SDK Version: 48.0.20
  2. Platforms(Android/iOS/web/all): iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on
  4. Expo Workflow: bare

I set up remote push notifications to work on iOS in the foreground. When I ran my app through Expo, it worked as expected. However, when I built it for production, my app could not receive notifications in the foreground or call the callback when a user tapped on a notification.

I have checked the following:

  • Xcode project has Push notification permission
  • Application is configured to receive push notifications
  • I turned on iosDisplayInForeground on app.json
    "notification": {
      "iosDisplayInForeground": true,
      "androidMode": "default"
    }
  • I tried to added these lines to my AppDelegate.mm :
// Linking API
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
}

// Universal Links
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
  BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
  return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
}

// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
  return [super application:application didFailToRegisterForRemoteNotificationsWithError:error];
}

// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
  return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
  • I use EAS to build my app

I am not sure what is causing the issue. I would appreciate any help you can provide. I took 3 days to read all related tickets, but I found nothing helpful.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.