Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰] iOS - ITMS-90078: Missing Push Notification Entitlement #7741

Open
2 of 10 tasks
idrisssakhi opened this issue Apr 9, 2024 · 4 comments
Open
2 of 10 tasks
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report

Comments

@idrisssakhi
Copy link

Issue

Describe your issue here
While using firebase with my react-native i am getting an issue on iOS side telling that the push notification Entitlement is missing even thought i do not use could messaging i only use auth and firestore. the issue is comming from @react-native-firebase/app which call registerUserNotificationSettings under the hood.


Project Files

Javascript

Click To Expand

package.json:

{
  "name": "GeoWatch",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.json --no-error-on-unmatched-pattern",
    "lint:write": "yarn lint --fix",
    "tsc": "tsc",
    "tsc:check": "tsc --noEmit --skipLibCheck",
    "postinstall": "patch-package",
    "start": "react-native start",
    "test": "jest",
    "husky:pre-commit": "yarn tsc:check && lint-staged",
    "prepare": "husky",
    "pod-install-new-arch": "RCT_NEW_ARCH_ENABLED=1 bundle exec pod install"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "6.5.2",
    "@fortawesome/free-brands-svg-icons": "6.5.2",
    "@fortawesome/free-solid-svg-icons": "6.5.2",
    "@fortawesome/react-native-fontawesome": "0.3.0",
    "@gorhom/bottom-sheet": "5.0.0-alpha.9",
    "@lodev09/react-native-exify": "0.2.6",
    "@react-native-camera-roll/camera-roll": "7.5.2",
    "@react-native-community/geolocation": "3.2.1",
    "@react-native-firebase/app": "19.1.2",
    "@react-native-firebase/auth": "19.1.2",
    "@react-native-firebase/firestore": "19.1.2",
    "@react-native-firebase/storage": "19.1.2",
    "@react-navigation/bottom-tabs": "7.0.0-alpha.20",
    "@react-navigation/native": "7.0.0-alpha.18",
    "@react-navigation/native-stack": "7.0.0-alpha.20",
    "@tanstack/react-query": "5.29.0",
    "@turf/boolean-point-in-polygon": "6.5.0",
    "@turf/helpers": "6.5.0",
    "axios": "1.6.8",
    "dayjs": "1.11.10",
    "i18next": "23.11.0",
    "iban": "0.0.14",
    "intl-pluralrules": "2.0.1",
    "react": "18.2.0",
    "react-hook-form": "7.51.2",
    "react-i18next": "14.1.0",
    "react-native": "0.73.6",
    "react-native-avoid-softinput": "5.0.0",
    "react-native-compass-heading": "1.5.0",
    "react-native-gesture-handler": "2.16.0",
    "react-native-image-picker": "7.1.2",
    "react-native-localize": "3.1.0",
    "react-native-maps": "1.13.0",
    "react-native-mmkv": "2.12.2",
    "react-native-reanimated": "3.8.1",
    "react-native-safe-area-context": "4.9.0",
    "react-native-screens": "3.30.1",
    "react-native-simple-toast": "3.3.1",
    "react-native-svg": "15.1.0",
    "react-native-vision-camera": "4.0.0-beta.13"
  },
  "devDependencies": {
    "@babel/core": "7.24.4",
    "@babel/plugin-transform-export-namespace-from": "7.24.1",
    "@babel/plugin-transform-react-jsx": "7.23.4",
    "@babel/preset-env": "7.24.4",
    "@babel/preset-typescript": "7.24.1",
    "@babel/runtime": "7.24.4",
    "@react-native/babel-preset": "0.75.0-main",
    "@react-native/eslint-config": "0.75.0-main",
    "@react-native/metro-config": "0.75.0-main",
    "@react-native/typescript-config": "0.75.0-main",
    "@types/iban": "0.0.35",
    "@types/jest": "29.5.12",
    "@types/react": "18.2.75",
    "@types/react-test-renderer": "18.0.7",
    "@typescript-eslint/eslint-plugin": "7.6.0",
    "@typescript-eslint/parser": "7.6.0",
    "babel-jest": "29.7.0",
    "babel-plugin-module-resolver": "5.0.0",
    "babel-plugin-transform-remove-console": "6.9.4",
    "eslint": "9.0.0",
    "eslint-config-prettier": "9.1.0",
    "eslint-import-resolver-typescript": "3.6.1",
    "eslint-plugin-ft-flow": "3.0.7",
    "eslint-plugin-import": "2.29.1",
    "eslint-plugin-jest": "28.2.0",
    "eslint-plugin-json": "3.1.0",
    "eslint-plugin-prettier": "5.1.3",
    "eslint-plugin-react-hooks": "4.6.0",
    "eslint-plugin-testing-library": "6.2.0",
    "eslint-plugin-tsdoc": "0.2.17",
    "husky": "9.0.11",
    "jest": "29.7.0",
    "lint-staged": "15.2.2",
    "patch-package": "8.0.0",
    "prettier": "3.2.5",
    "prettier-plugin-jsdoc": "1.3.0",
    "react-native-svg-transformer": "1.3.0",
    "react-test-renderer": "18.2.0",
    "typescript": "5.4.4"
  },
  "engines": {
    "node": ">=18"
  }
}

firebase.json for react-native-firebase v6:

{
    "react-native": {
      "database_persistence_enabled": true
    }
}

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'GeoWatchApp' do
  config = use_native_modules!

  use_frameworks! :linkage => :static
  
  use_react_native!(
    :path => config[:reactNativePath],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.disabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'GeoWatchAppTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
  end
end

AppDelegate.m:

#import "AppDelegate.h"

// for firebase
#import <Firebase.h>

#import <React/RCTBundleURLProvider.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.moduleName = @"GeoWatchApp";
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};

  [FIRApp configure];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
  return [self getBundleURL];
}

- (NSURL *)getBundleURL
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end


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 13.6.6
  CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Memory: 266.41 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 10.2.4
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
  • Platform that you're experiencing the issue on:
    • 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:
    • 19.1.2
  • Firebase module(s) you're using that has the issue:
    • app
  • Are you using TypeScript?
    • Y & 5.4.4


@idrisssakhi idrisssakhi added Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report labels Apr 9, 2024
@Daniel3711997
Copy link

confirmed, setting FirebaseAppDelegateProxyEnabled to false still causes the issue

@mikehardy
Copy link
Collaborator

firebase auth uses push notifications on iOS to avoid doing a reCAPTCHA if you use phone auth:
https://firebase.google.com/docs/auth/ios/phone-auth#start-receiving-silent-notifications

You assert registerUserNotificationSettings is called but I see no hits:

https://github.com/search?q=repo%3Ainvertase%2Freact-native-firebase%20registerUserNotificationSettings&type=code

You can drop a code link in here to the callchain you think is calling that?

@younes0
Copy link

younes0 commented May 11, 2024

@Daniel3711997 @idrisssakhi are you using expo (and have not expo-notification installed) ?
If so, you have to update your app.config.js and add the aps-environment key since there was a breaking change removing its automatic adding. Example:

entitlements: {
  "aps-environment": env === process.env.NODE_ENV === "development" ? "development" : "production",
},

see: expo/expo#27668

@muammadibal
Copy link

@Daniel3711997 @idrisssakhi are you using expo (and have not expo-notification installed) ? If so, you have to update your app.config.js and add the aps-environment key since there was a breaking change removing its automatic adding. Example:

entitlements: {
  "aps-environment": env === process.env.NODE_ENV === "development" ? "development" : "production",
},

see: expo/expo#27668

what about in cli?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report
Projects
None yet
Development

No branches or pull requests

5 participants