react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[v2][iOS] Upgraded to RN 0.59 issue with AppDelegate.m

Open harveyconnor opened this issue 7 years ago • 57 comments

Issue Description

I've upgraded my react-native to the stable 0.59 release but am receiving a console warning that contains the following error:

Unable to define method 'getConstants()' on NativeModule 'RNNBridgeModule'. NativeModule 'RNNBridgeModule' already has a constant or method called 'getConstants'. Please remove it.

This only occurs after installing RNN.

Steps to Reproduce / Code Snippets / Screenshots

AppDelegate.m


#import "AppDelegate.h"

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

#import <ReactNativeNavigation/ReactNativeNavigation.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  
  [ReactNativeNavigation bootstrap:[self sourceURLForBridge: bridge] launchOptions:launchOptions];
  
  return YES;
}

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

@end



Environment

  • React Native Navigation version: 2.13.1
  • React Native version: 0.59.0
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): iPhone 6 (Debug)

harveyconnor avatar Mar 14 '19 03:03 harveyconnor

https://github.com/wix/react-native-navigation/issues/4853#issuecomment-472353418

retyui avatar Mar 14 '19 07:03 retyui

#4853 (comment)

I tried that solution but it failed to work. I'm also receiving messages in my console that may be related:

PerformanceLogger: Attempting to start a timespan that already exists renderApplication_React_render PerformanceLogger: Attempting to end a timespan that has already ended renderApplication_React_render Unbalanced calls start/end for tag 14

Not sure, any help would be awesome!

harveyconnor avatar Mar 14 '19 22:03 harveyconnor

#4853 (comment)

This solution keeps me stuck on the initial screen. Any other suggestions?

thilook avatar Mar 15 '19 01:03 thilook

I update to rn 0.59 without any problem

retyui avatar Mar 15 '19 10:03 retyui

#4853 (comment)

Are you using this solution? Or your AppDelegate.m looks different? Could you share with us?

thilook avatar Mar 15 '19 11:03 thilook

#4853 (comment)

Are you using this solution? Or your AppDelegate.m looks different? Could you share with us?

Your issue appears to be different, have you made sure to re-follow the RNN instructions when installing. I'd suggest rm -rf node_modules and then re-linking RNN

harveyconnor avatar Mar 17 '19 22:03 harveyconnor

Closing as this seems to be a none issue, Thanks @retyui for taking the time to help other users ❤️

guyca avatar Apr 01 '19 06:04 guyca

@harveyconnor @retyui With regards to this, is there any information for 0.59.3? I am having issues not being able to follow the documentation about the AppDelegate.m, where i cannot use react-native-git-upgrade. Which i quite lost in what to do.

Seamus-melco avatar Apr 02 '19 09:04 Seamus-melco

@Seamus-melco It should work, I did from a clean install and it works. However there are a bunch of log messages that occur that might put you off, but I've chosen to ignore them for now.

harveyconnor avatar Apr 02 '19 22:04 harveyconnor

Have the same warning - Unable to define method 'getConstants()' on NativeModule 'RNNBridgeModule'. Have somebody decision for these ? Screenshot at Apr 10 14-30-22

Alekseyideas avatar Apr 10 '19 11:04 Alekseyideas

I get the warning PerformanceLogger: Attempting to start a timespan that already exists renderApplication_React_render too. And also a slight delay in rendering. Is that known?

pontusab avatar Apr 10 '19 15:04 pontusab

@Alekseyideas @pontusab I get both of those logs and my console is full of them when I launch the app.

harveyconnor avatar Apr 10 '19 23:04 harveyconnor

same message on both Android and iOS:

on Android:

'PerformanceLogger: Attempting to start a timespan that already exists ', 'renderApplication_React_render'
'PerformanceLogger: Attempting to end a timespan that has already ended ', 'renderApplication_React_render'

on iOS:

[info][tid:com.facebook.react.JavaScript] 'PerformanceLogger: Attempting to start a timespan that already exists ', 'renderApplication_React_render'
[info][tid:com.facebook.react.JavaScript] 'PerformanceLogger: Attempting to end a timespan that has already ended ', 'renderApplication_React_render'

sophister avatar Apr 11 '19 06:04 sophister

Same for me

RuairiOliver avatar Apr 11 '19 09:04 RuairiOliver

I have the same problem in combination with react-native-image-crop-picker

StasDoskalenko avatar Apr 15 '19 15:04 StasDoskalenko

Same problem on Android

lunatupini avatar Apr 15 '19 15:04 lunatupini

Same problem on Android

aliakbarazizi avatar Apr 18 '19 10:04 aliakbarazizi

@guyca is there any status on fixing this?

harveyconnor avatar Apr 18 '19 11:04 harveyconnor

I am having the same issue as well. New project using RN v 0.59.6. I get the error both on iOS and Android.

I copied

AppDelegate.h

and

AppDelegate.m

referenced by @retyui above to make sure there were no typo's.

Versions :

  "dependencies": {
    "react": "16.8.6",
    "react-native": "^0.59.6",
    "react-native-navigation": "^2.17.0"
  }, ...

OS: macOS Mojave

Can anyone using RN v0.59.x and NOT having this problem, respond to this issue and let us know what version of react-native-navigation you are using?

Thanks.

odesey avatar Apr 18 '19 22:04 odesey