Skip to content

🔥NSInvalidArgumentException: -[__NSCFBoolean length]: unrecognized selector sent to instance #3536

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 6 tasks
guillaume-g opened this issue Apr 24, 2020 · 2 comments
Closed
1 of 6 tasks

Comments

@guillaume-g
Copy link

🔥 Hello guys,

First I want to thank you all for your work !

[x] If this is a setup issue then please make sure you've correctly followed the setup guides, most setup issues such as 'duplicate dex files', 'default app has not been initialized' etc are all down to an incorrect setup as the guides haven't been correctly followed.

Issue

When I try to request permissions on iOS, I got the following error and then the application crash.
This is a problem related to iOS, Android is working perfectly fine.
I have followed every step on your documentation, every configuration, I have been on this issue for a week...
Everything is correctly linked, I am using Messaging, Performance, etc and only messaging as a problem, only on iOS.

Two behaviours => it either ask for permissions then crash or just crash, when requestPermission() is called.


Logs

NSInvalidArgumentException: -[__NSCFBoolean length]: unrecognized selector sent to instance 0x1b376d798
?, in _ZN8facebook5react11JSIExecutor21defaultTimeoutInvokerERKNSt3__18functionIFvvEEENS3_IFNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvEEE
?, in _ZN8facebook5react11JSIExecutor21defaultTimeoutInvokerERKNSt3__18functionIFvvEEENS3_IFNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvEEE
?, in _ZN8facebook5react11JSIExecutor21defaultTimeoutInvokerERKNSt3__18functionIFvvEEENS3_IFNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvEEE
?, in _ZN8facebook5react11JSIExecutor21defaultTimeoutInvokerERKNSt3__18functionIFvvEEENS3_IFNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvEEE
?, in _ZN8facebook5react11JSIExecutor21defaultTimeoutInvokerERKNSt3__18functionIFvvEEENS3_IFNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvEEE
...
(16 additional frame(s) were not displayed)


Javascript

if (!isInit && !DeviceInfo.isEmulatorSync()) {
         await messaging.registerDeviceForRemoteMessages();
	const oldPermission = await messaging().hasPermission();

        if (oldPermission === fbMessaging.AuthorizationStatus.NOT_DETERMINED) {
		const permission = await messaging().requestPermission();

		if (permission === fbMessaging.AuthorizationStatus.AUTHORIZED) {
              		// do something
		}
	} else if (oldPermission === fbMessaging.AuthorizationStatus.AUTHORIZED) {
        	// do something
	} else {
		await Promise.resolve();
	}
}

package.json:

    "@expo/react-native-responsive-image": "^2.0.0",
    "@expo/vector-icons": "^10.0.0",
    "@react-native-community/masked-view": "0.1.5",
    "@react-native-firebase/analytics": "^6.3.4",
    "@react-native-firebase/app": "^6.3.4",
    "@react-native-firebase/messaging": "^6.3.4",
    "@react-native-firebase/perf": "^6.3.4",
    "@react-navigation/native": "^5.0.5",
    "@react-navigation/stack": "5.4.0",
    "@sentry/react-native": "^1.3.2",
    "axios": "^0.19.0",
    "expo": "^36.0.0",
    "expo-font": "~8.0.0",
    "expo-in-app-purchases": "^8.0.0",
    "expo-linear-gradient": "~8.0.0",
    "expo-localization": "^8.0.0",
    "formik": "^2.1.0",
    "lodash.flatten": "^4.4.0",
    "lodash.uniq": "^4.5.0",
    "lodash.uniqby": "^4.7.0",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.28",
    "react": "~16.9.0",
    "react-dom": "16.9.0",
    "react-native": "~0.61.4",
    "react-native-device-info": "^5.5.3",
    "react-native-easy-grid": "^0.2.2",
    "react-native-extended-stylesheet": "^0.12.0",
    "react-native-fbads": "^6.3.1",
    "react-native-flash-message": "^0.1.15",
    "react-native-gesture-handler": "~1.5.0",
    "react-native-pdf": "^6.1.1",
    "react-native-reanimated": "~1.4.0",
    "react-native-safe-area-context": "0.6.0",
    "react-native-screens": "2.0.0-alpha.12",
    "react-native-splash-screen": "^3.2.0",
    "react-native-tab-view": "^2.10.0",
    "react-native-unimodules": "~0.7.0",
    "react-native-web": "~0.11.7",
    "rn-fetch-blob": "^0.12.0",
    "sentry-expo": "^2.0.3",
    "socket.io-client": "^2.3.0",
    "yup": "^0.28.0"

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:
platform :ios, '10.0'

require_relative '../node_modules/react-native-unimodules/cocoapods'

target 'MTGSport' do

  rnPrefix = "../node_modules/react-native"

  # React Native and its dependencies
  pod 'FBLazyVector', :path => "#{rnPrefix}/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "#{rnPrefix}/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "#{rnPrefix}/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "#{rnPrefix}/Libraries/TypeSafety"
  pod 'React', :path => "#{rnPrefix}/"
  pod 'React-Core', :path => "#{rnPrefix}/"
  pod 'React-CoreModules', :path => "#{rnPrefix}/React/CoreModules"
  pod 'React-RCTActionSheet', :path => "#{rnPrefix}/Libraries/ActionSheetIOS"
  pod 'React-RCTAnimation', :path => "#{rnPrefix}/Libraries/NativeAnimation"
  pod 'React-RCTBlob', :path => "#{rnPrefix}/Libraries/Blob"
  pod 'React-RCTImage', :path => "#{rnPrefix}/Libraries/Image"
  pod 'React-RCTLinking', :path => "#{rnPrefix}/Libraries/LinkingIOS"
  pod 'React-RCTNetwork', :path => "#{rnPrefix}/Libraries/Network"
  pod 'React-RCTSettings', :path => "#{rnPrefix}/Libraries/Settings"
  pod 'React-RCTText', :path => "#{rnPrefix}/Libraries/Text"
  pod 'React-RCTVibration', :path => "#{rnPrefix}/Libraries/Vibration"
  pod 'React-Core/RCTWebSocket', :path => "#{rnPrefix}/"
  pod 'React-Core/DevSupport', :path => "#{rnPrefix}/"
  pod 'React-cxxreact', :path => "#{rnPrefix}/ReactCommon/cxxreact"
  pod 'React-jsi', :path => "#{rnPrefix}/ReactCommon/jsi"
  pod 'React-jsiexecutor', :path => "#{rnPrefix}/ReactCommon/jsiexecutor"
  pod 'React-jsinspector', :path => "#{rnPrefix}/ReactCommon/jsinspector"
  pod 'ReactCommon/jscallinvoker', :path => "#{rnPrefix}/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "#{rnPrefix}/ReactCommon"
  pod 'Yoga', :path => "#{rnPrefix}/ReactCommon/yoga"
  pod 'DoubleConversion', :podspec => "#{rnPrefix}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rnPrefix}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rnPrefix}/third-party-podspecs/Folly.podspec"

  # Expo deps

  # Other native modules
  pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
  pod 'RNReanimated', :podspec => '../node_modules/react-native-reanimated/RNReanimated.podspec'
  pod 'RNScreens', :path => '../node_modules/react-native-screens'
  pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context'

  pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics'
  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  pod 'GoogleIDFASupport', '~> 3.14.0'
  pod 'Firebase/Messaging', '~> 6.13.0'
  pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'
  pod 'RNFBPerf', :path => '../node_modules/@react-native-firebase/perf'

  pod 'FBAudienceNetwork', '= 5.5.0'
  pod 'ReactNativeAdsFacebook', :path => '../node_modules/react-native-fbads'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  # Automatically detect installed unimodules
  use_unimodules!
  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'

  pod 'react-native-pdf', :path => '../node_modules/react-native-pdf'

end

AppDelegate.m:

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import <Firebase.h>
#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <UMCore/UMModuleRegistry.h>
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>

@implementation AppDelegate

@synthesize window = _window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"MTGSport" initialProperties:nil];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  if ([FIRApp defaultApp] == nil) {
    [FIRApp configure];
  }

  [super application:application didFinishLaunchingWithOptions:launchOptions];

  return YES;
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
  NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
  // You can inject any extra modules that you would like here, more information at:
  // https://facebook.github.io/react-native/docs/native-modules-ios.html#dependency-injection
  return extraModules;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
#ifdef DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@benadamstyles 


Environment

Click To Expand

react-native info output:

System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 194.46 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.15.0 - ~/.nvm/versions/node/v12.15.0/bin/node
    Yarn: 1.9.4 - ~/.yarn/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.15.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
    Android SDK:
      API Levels: 26, 28, 29
      Build Tools: 28.0.3, 29.0.3
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: ~16.9.0 => 16.9.0 
    react-native: ~0.61.4 => 0.61.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:
    • 6.7.1
  • Firebase module(s) you're using that has the issue:
    • @react-native-firebase/messaging
  • Are you using TypeScript?
    • No

Thanks in advance for your help, I am really stuck here and it's the only bug left before production <3


@mikehardy
Copy link
Collaborator

I think you need the results of #3339 which are present in version 6.7.1. Please try upgrading, re-testing, and reporting back?

@guillaume-g
Copy link
Author

Hi,

I indeed upgraded to the latest version and it worked !

Thanks ;)

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

No branches or pull requests

2 participants