React-native: white screen in iOS device when deploying on staging and production

Created on 2 Nov 2017  Â·  12Comments  Â·  Source: facebook/react-native

Is this a bug report?

yes

Have you read the Contributing Guidelines?

yes

Environment

Steps to Reproduce

(Write your steps here:)

  1. launching iOS application from simulator or device in my machine works fine
    2.when deploying on staging or production iam getting white screen at launch
  2. iam not getting this issue in android

Expected Behavior

(Write what you thought would happen.)

Actual Behavior

white screen cam not understanding . trying to change appdelegate.m like this :
NSURL *jsCodeLocation;
//#ifdef DEBUG
// jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
//#else
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
//#endif
//self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
//self.window.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
//[[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation launchOptions:launchOptions];
but now i am blocked in splashScreen .
help please

here is my Appdelegate.m:

import "AppDelegate.h"

import

import

import "RCCManager.h"

import

import

import

import

@implementation AppDelegate

// Required to register for notifications

  • (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
    {
    [RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings];
    }
    // Required for the register event.
  • (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
    {
    [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
    }
    // Required for the registrationError event.
  • (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
    {
    [RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];
    }
    // Required for the localNotification event.
  • (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
    {
    [RCTPushNotificationManager didReceiveLocalNotification:notification];
    }

@end

(Write what happened. Add screenshots!)

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

iOS Stale

Most helpful comment

I have same problem.

All 12 comments

I have same problem.

i can build normally my iOS application in simulator or device in debug between deploying in staging or release my application freeze with white screen after passing the splash screen .
id ont have this problem in android .
"": "^3.1.0",
"assert": "^1.4.1",
"babel-preset-react-native-stage-0": "^1.0.1",
"bamlab-react-native-smooch": "^0.3.0",
"base-64": "^0.1.0",
"browserify-zlib": "^0.1.4",
"bytebuffer": "^5.0.1",
"console-browserify": "^1.1.0",
"constants-browserify": "^1.0.0",
"dns.js": "^1.0.1",
"domain-browser": "^1.1.7",
"events": "^1.1.1",
"https-browserify": "0.0.1",
"install": "^0.10.1",
"lodash": "^4.17.4",
"mockdate": "^2.0.2",
"moment": "^2.19.1",
"net": "^1.0.2",
"numeral": "^2.0.4",
"path-browserify": "0.0.0",
"process": "^0.11.10",
"prop-types": "^15.6.0",
"querystring": "^0.2.0",
"querystring-es3": "^0.2.1",
"react": "16.0.0",
"react-native": "0.49.3",
"react-native-crypto": "^2.1.1",
"react-native-datepicker": "^1.6.0",
"react-native-drawer-layout": "^1.3.2",
"react-native-fbsdk": "^0.6.3",
"react-native-fetch-blob": "^0.10.8",
"react-native-form-idable": "^1.0.2",
"react-native-gcm-android": "^0.2.0",
"react-native-google-analytics-bridge": "^5.0.1",
"react-native-http": "github:tradle/react-native-http#834492d",
"react-native-i18n": "^1.0.0",
"react-native-level-fs": "^3.0.0",
"react-native-linear-gradient": "^2.3.0",
"react-native-md5": "^1.0.0",
"react-native-navigation": "^1.1.260",
"react-native-os": "^1.1.0",
"react-native-push-notification": "^3.0.0",
"react-native-randombytes": "^3.0.0",
"react-native-root-siblings": "^1.2.1",
"react-native-root-toast": "^1.3.0",
"react-native-svg": "^5.4.2",
"react-native-swipeout": "^2.2.2",
"react-native-swiper": "^1.5.13",
"react-native-system-notification": "^0.2.1",
"react-native-tcp": "^3.3.0",
"react-native-udp": "^2.2.0",
"react-native-vector-icons": "^4.4.2",
"react-redux": "^5.0.6",
"react-static-container": "^1.0.1",
"readable-stream": "^1.0.33",
"redux": "^3.6.0",
"redux-enhancer-react-native-appstate": "^0.1.1",
"redux-logger": "^2.7.4",
"redux-persist": "^4.4.1",
"redux-saga": "^0.14.3",
"stream-browserify": "^1.0.0",
"superagent": "^3.3.2",
"timers-browserify": "^1.4.2",
"tty-browserify": "0.0.0",
"url": "^0.10.3",
"victory-native": "^0.15.0",
"vm-browserify": "0.0.4"

/**

Copyright (c) 2015-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
*/

import "AppDelegate.h"

import

import

import

import

import

import

@implementation AppDelegate

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"x"
initialProperties:nil
launchOptions:launchOptions];
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];

[Smooch initWithSettings: [SKTSettings settingsWithAppToken:@"x"]];
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
return YES;
}

(void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}

(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
[[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
[RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
return YES;
}

// Required to register for notifications

(void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the registrationError event.
(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for the localNotification event.
(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[RCTPushNotificationManager didReceiveLocalNotification:notification];
}
@EnD

thanks for your help

any help

i am applying the steps described in Facebook documentation :
in the project folder in Terminal run react-native bundle --platfrom ios --dev false --entry-file index.ios.js --bundle-output main.jsbundle Drag the reference to the main.jsbundle file into XCode under myapp folder In XCode, open AppDelegate.m and uncomment jsCodeLocation = [[NSBundle mainBundle]… Open Product > Scheme > Edit Scheme then change Build Configuration to Release Select myapp under the project navigator and then: under TARGETS: myappTests > Build Phases > Link Binary With Libraries press + select Workspace > libReact.a and Add compile in XCode with the ../node_modules/react-native/scripts/react-native-xcode.sh

always having white screen after passing the splash screen when deploying in release . it i really blocking me
thanks for your reply

Same problem in the lastest version 0.51. Any ideas?

In my case, it caused by the version of node.js.
When I set "nvm use new_version" in react-native-xcode.sh, it ran correctly.

I have the same error, could you solve it? thanks

I have this issue as well, and it's driving me insane. I have tried everything from manually compiling the main.jsbundle to re-installing all node modules. Any luck?

In my case , i Was obliged to back to rn 0.42 . I have deleted all my repo in my machine and insrall all the project with rn 0.42 . After that i tried to upgrade to 0.44 and in worked . At launch the app freeze for 1 or 2 second with white screen then it launched normally .

In case anyone else gets here the same way I did:

I was seeing these symptoms and it was actually a bug in my code that I hadn't caught. Somewhere along the way a bug was introduced that caused my app to crash on a fresh install. I'm still relatively new to react native and don't know how to find logs or error messages once you aren't debugging, but if you find yourself in this situation maybe try to figure out if there could be any bugs from a clean install (you can delete and re-deploy via debug to simulate a fresh install I think, that helped me anyway)

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings