skip to Main Content

I’ve recently updated react native to the latest version (as painful as it is), and I’m getting this error. The code compiles fine but as soon as the app runs I receive this.

'RCTAppDelegate::bundleURL not implemented', reason: 'Subclasses must implement a valid getBundleURL method'

Any ideas? Thanks!

2

Answers


  1. I was having the same problem for almost 1 month but after all the solutions with other’s help, I solved it by downgrading to 0.72.14 of react native by myself,
    after downgrading the build was failing due to an issue which I solved from here => Solution

    this is temporary but a working one
    don’t forget to use

    npx react-native run-ios
    

    after downgrading

    Login or Signup to reply.
  2. I’ve been through this as well and solved this issue by dividing the sourceURLForBridge method inside the AppDelegate.m into two functions:

    If you’re using expo it should be:

    - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
    {
      return [self bundleURL];
    }
    
    - (NSURL *)bundleURL
    {
    #if DEBUG
      return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"];
    #else
      return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
    #endif
    }
    

    If you’re using plain cli it should be:

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

    This is also how you’re AppDelegate looks like, if you create a plain new project – which is always a good reference after updating an old one.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search