3

When I try to build my React Native App from XCode in Release mode to check before launch it to production it get stuck in old code. No matter what change I do in my JS file that it won't do it. In Debug mode it doesn't happen, just works fine like it should.

Example:

I change a label in any of my JS files like a title of some menu and it will work when I use react-native run-ios or if I press on "Play" button of XCode if in the scheme "Debug" is checked. If instead, I check "Release" it charge an old version of my app I don't even know with certainly which version is.

I have tried to launch to production but still being the old version.

So, now a day I can't upload new version due to no matter what changes I do, the release mode ignores it.

I have tried to generate a new main.jsbundle, I have cleaned build with Shift + CMD + K and I aso have reinstalled my npm with no solution.

Do you have any idea?

EDIT:

Does the file "AppDelegate.m" have anything to do with it?

This is my AppDelegate:

#import "AppDelegate.h" #import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h> @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"BottomNavigation" 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]; 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 
6
  • Can you try with this ios re-bundler command: react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios/assets Commented Nov 22, 2019 at 9:26
  • Hi @Kuray-FreakyCoder- . It created a new main.jsbundle but when I build and run still not changing anything. Commented Nov 22, 2019 at 9:35
  • 1
    Can you share a reproducible example with me? Commented Nov 22, 2019 at 11:00
  • I don't really know how could I share a reproducible example. Just my app ignore any change I would do if the scheme is in Release mode. If I run the react-native run-ios command or put the scheme in Debug mode it will work as should work. And to upload to the app store i need the Release mode right. Commented Nov 22, 2019 at 11:06
  • what i do to test rn ios app is: build archive and upload then test using TestFlight app Commented Nov 22, 2019 at 11:18

2 Answers 2

7

As I posted here: https://stackoverflow.com/a/59029751/8898886

Finally I found the solution.

The problem was that the main.jsbundle I was generating was placing in the wrong place having 2 main.jsbundle at the same time, the old and corrupted and the right one.

I had the right one outside /ios/ProjectName and the old one there. I just had to apply this snippet which would generate a new and clean main.jsbundle:

react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios/assets 

and then get the file main.jsbundle and the assets folder and place them inside /ios/ProjectName

Thanks all for the help.

Sign up to request clarification or add additional context in comments.

Comments

0

Before archive stop already running node and start server and now make archive

npm start -- --reset-cache 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.