Skip to content

[firebase_messaging] No Message in iOS Release Mode #2672

@tuanha2000vn

Description

@tuanha2000vn

Describe the bug
Android Debug: Work
Android Release: Work
iOS Debug: Work
iOS Release: Not Work

To Reproduce


Steps to reproduce the behavior:

  1. Clone sample app: https://github.com/tuanha2000vn/fcm_ios_release_bug
  2. Build iOS App and click the button 'https://fcm.googleapis.com/fcm/send'
  3. Notice the difference of iOS app in Debug Mode vs Release Mode result

Expected behavior
Send data:

{
 "to" : "d944GNsO90n6mOdYPd21hl:APA91bF7SONl9E7E4sFhtTdKeH_Zmesh_n1KJAWE_y7Kod8z9RSa8hHFMKELv0WHGUAGdxdiZVwNYPyPTxSxODIE-e8wyqKs2C-lhQ6JPocxJmZueMiTfRj-HcD-QvqRXpGIefj4K-Nw",
 "collapse_key" : "type_a",
 "notification" : {
     "body" : "Body of Your Notification",
     "title": "Title of Your Notification"
 },
 "data" : {
     "body" : "Body of Your Notification in Data",
     "title": "Title of Your Notification in Title",
     "key_1" : "Value for key_1",
     "key_2" : "Value for key_2"
 }
}

iOS Debug:

{
    "multicast_id": 2894437391698496198,
    "success": 1,
    "failure": 0,
    "canonical_ids": 0,
    "results": [
        {
            "message_id": "1590877840476643"
        }
    ]
}

iOS Release:

{
    "multicast_id": 1281464412959576484,
    "success": 0,
    "failure": 1,
    "canonical_ids": 0,
    "results": [
        {
            "error": "InvalidRegistration"
        }
    ]
}

Additional context
pubspec.yaml

name: hassdash
description: A new Flutter application.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  firebase_analytics: any
  firebase_messaging: 6.0.16
  firebase_core: ^0.4.0

dev_dependencies:
  flutter_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true
  # To add assets to your application, add an assets section, like this:
  # assets:
  #  - images/a_dot_burr.jpeg
  #  - images/a_dot_ham.jpeg
  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.
  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages
  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

Flutter doctor
Run flutter doctor and paste the output below:

[✓] Flutter (Channel v1.12.13-hotfixes, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale en-VN)
    • Flutter version 1.12.13+hotfix.9 at /Users/hoanganhtuan/development/flutter
    • Framework revision f139b11009 (9 weeks ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/hoanganhtuan/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-R, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4.1, Build version 11E503a
    • CocoaPods version 1.9.1

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.45.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.10.2

[✓] Connected device (4 available)
    • Nokia 7 plus              • B2NGAA8830704049                         • android-arm64 • Android 10 (API 29)
    • Android SDK built for x86 • emulator-5554                            • android-x86   • Android 10 (API 29) (emulator)
    • TuanHA’s iPhone X         • c938992824b3503c5d9daff372c9bb4644d4b330 • ios           • iOS 13.4.1
    • iPhone 11                 • 91E970E4-89D5-41D9-9FEC-C281D4FD6B66     • ios           • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions