Skip to content

silent notifications don't work on ios 13 #2956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 9 tasks
rogerkerse opened this issue Dec 2, 2019 · 9 comments · Fixed by #3339
Closed
1 of 9 tasks

silent notifications don't work on ios 13 #2956

rogerkerse opened this issue Dec 2, 2019 · 9 comments · Fixed by #3339

Comments

@rogerkerse
Copy link

Issue

Sending silent notifications to iOS 13 device doesn't work. I have code that worked on ios12 and it used rn-firebase v5. Now that I build it on iOS 13 it doen't work. Tried upgrading to rn-firebase v6 but still the same issue. getToken() method gives push notification token, but when message is sent, it arrives on Android but not on iOS.

const granted = await messaging().requestPermission();
const notificationToken = await messaging().getToken();

So in all cases (iOS 12, iOS 13, Android) I get token. When I send out notification, iOS 13 is the only one who doesn't receive it with messaging().onMessage((data) => console.log(data))


Project Files

Javascript

Click To Expand

package.json:

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'app' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'Fabric'
  pod 'Crashlytics'
  # The line is here only that it wouldn't install the whole module, but only necessary components
  pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
    'BarcodeDetectorMLKit'
  ]

  target 'appTests' do
    inherit! :search_paths
    # Pods for testing
  end
  use_native_modules!
end

target 'app-tvOS' do
  # Pods for app-tvOS
  target 'app-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

System:
    OS: macOS 10.15.1
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 1.05 GB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.2.0 - ~/.nvm/versions/node/v13.2.0/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.13.1 - ~/.nvm/versions/node/v13.2.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5
  • Platform that you're experiencing the issue on:
    • [x ] iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • both 6.0.3 and 6.1.0
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION


Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

@ShyamPanchal
Copy link

firebase.messaging().onMessage((message: RemoteMessage) not called on ios 13 (versions tested: 13.1.3, 13.2.1, 13.2.3).

@rogerkerse
Copy link
Author

I managed to get it working with a weird workaround. This definitely should not be the case or solution.

In 'AppDelegate.m' I write

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [application registerForRemoteNotifications]; // <---- ADD THIS
    ...
}

And in JavaScript I only need to do this

const notificationToken = await messaging().getToken(); // <-- Gives me token

Without XCode part getToken() function fails with an error. await messaging().registerForRemoteNotifications() nor await messaging().requestPermission() in JavaScript help. AppDelegate.m change is the only thing that makes it work.

@stale
Copy link

stale bot commented Jan 2, 2020

Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label Jan 2, 2020
@OmarBasem
Copy link

I can receive notification while app in background or killed, but not in foreground. All was working until i updated to ios 13. Anyfix to this?

@stale stale bot removed the Type: Stale Issue has become stale - automatically added by Stale bot label Jan 5, 2020
@priyasamyal
Copy link

I managed to get it working with a weird workaround. This definitely should not be the case or solution.

In 'AppDelegate.m' I write

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [application registerForRemoteNotifications]; // <---- ADD THIS
    ...
}

And in JavaScript I only need to do this

const notificationToken = await messaging().getToken(); // <-- Gives me token

Without XCode part getToken() function fails with an error. await messaging().registerForRemoteNotifications() nor await messaging().requestPermission() in JavaScript help. AppDelegate.m change is the only thing that makes it work.

This works for me too.

@stale
Copy link

stale bot commented Feb 14, 2020

Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label Feb 14, 2020
@sezginriggs
Copy link

Unfortunately workaround doesn't work for me

@stale stale bot removed the Type: Stale Issue has become stale - automatically added by Stale bot label Feb 15, 2020
@stale
Copy link

stale bot commented Mar 14, 2020

Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label Mar 14, 2020
@Ehesp
Copy link
Member

Ehesp commented Mar 23, 2020

Hey all 👋 There's a draft PR available which fixes this issue and others, please check it out: #3339

We'll be doing a RC release once a few more things are implemented.

@stale stale bot removed the Type: Stale Issue has become stale - automatically added by Stale bot label Mar 23, 2020
@Salakar Salakar linked a pull request Mar 24, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants