react-native-splash-screen icon indicating copy to clipboard operation
react-native-splash-screen copied to clipboard

Splash screen not working on iOS13/RN 0.59.9

Open mobiledeveloperprogrammersio opened this issue 5 years ago • 10 comments

React Native Environment Info: System: OS: macOS 10.14.6 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 1.23 GB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.9.1 - /usr/local/bin/node npm: 6.10.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 IDEs: Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: 0.59.10 => 0.59.9 npmGlobalPackages: react-native-cli: 2.0.1

react-native-splash-screen version - 3.2.0

Platform does issue occur on - iOS

I was importing the library -

#import <RNSplashScreen.h> // here

and code inside the didFinishLaunchingWithOptions

[RNSplashScreen show]; // here

but splash screen crashed when i create the IPA and drop the IPA in the device using itunes. It is working fine for simulator also in debug mode. Issue exist for testFlight account.

If i put the below code

RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"MyApp" initialProperties:nil launchOptions:launchOptions];

[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];

then app do not crash on splash screen but it's hang on splash screen.

Please provide me the solution for this i am struggling with this issue.

facing the same issue here. Calling SplashScreen.hide() from the react-native side. the app just hangs

ShaharyarMaroof avatar Nov 05 '19 15:11 ShaharyarMaroof

I'm seeing similar when running an app w/ RN 0.60.5 (upgraded from 0.59.2) on iOS 13 using react-native start CLI build command w/ Metro Bundler. App hangs and doesn't close splash screen after calling SplashScreen.hide(). Seems to work correctly when building to device directly from Xcode.

jjhampton avatar Nov 05 '19 16:11 jjhampton

For me, it's not working even when building directly from Xcode. The app just crashes. and from the react-native run-ios command the app just gets stuck

ShaharyarMaroof avatar Nov 05 '19 16:11 ShaharyarMaroof

In file included from /Users/metinaltinbas/ReactProjects/ExpenseTracker/node_modules/react-        native-splash-screen/ios/RNSplashScreen.m:10:
/Users/metinaltinbas/ReactProjects/ExpenseTracker/node_modules/react-native-splash- 
screen/ios/RNSplashScreen.h:9:9: fatal error: 'React/RCTBridgeModule.h' file not found
#import <React/RCTBridgeModule.h>


The following build commands failed:
CompileC     /Users/metinaltinbas/ReactProjects/ExpenseTracker/ios/build/boiler361/Build/Intermediates.noind    ex/SplashScreen.build/Debug-iphonesimulator/SplashScreen.build/Objects-    normal/x86_64/RNSplashScreen.o     /Users/metinaltinbas/ReactProjects/ExpenseTracker/node_modules/react-native-splash-    screen/ios/RNSplashScreen.m normal x86_64 objective-c     com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

I am having this problem too. Is there any library to do the same thing?

metinaltinbas avatar Nov 05 '19 19:11 metinaltinbas

@metinaltinbas I haven't faced this issue. Try this stackoverflow link, it may help you.

ShaharyarMaroof avatar Nov 06 '19 14:11 ShaharyarMaroof

I had fixed splash screen issue in React Native CLI App (0.59.9) and tested in iOS 12 and 13.

We started getting stuck in this issue after updating iOS 12 to 13 version. Previously it was working fine with React Native Version (0.59.9). We did lot of R&D and tried several solutions provided on internet but none of the solution fixed that issue.

Issue was that, app was crashing after splash screen show for 10-15 sec on device in release mode and then we applied solution in appdelegate.m to fix crash issue then the app hang on splash screen.

After then we analys whole app and found that file (index.ios.js) was only working in debug mode and after creating build iOS ignoring that file. So, We had renamed the index.ios.js file to index.js and doing this fixed that splash screen issue. Finally app is working smoothly on both debug and release mode.

So, Please let us know if you get any success from this solution.

programmersio-dev avatar Nov 07 '19 12:11 programmersio-dev

@metinaltinbas responding directly to you as I did in the other issue since you asked.

Use this package, way better, I'd just like to increment its visibility (it's not mine) because I believe that the good work, and the effort that it requires, must be paid off somehow :)

https://github.com/zoontek/react-native-bootsplash

giacomocerquone avatar Nov 13 '19 08:11 giacomocerquone

@giacomocerquone you saved my life <3

rphlmr avatar Nov 21 '19 00:11 rphlmr

facing the same issue here. Calling SplashScreen.hide() from the react-native side. the app just hangs

Its very tricky but the problem is from adding [RNSplashScreen show]; in AppDelgegate.m{m} . I commented out [RNSplashScreen show]; (removed) from AppDelgegate.m{m}, everything works.

From what i see, i feel RN IOS triggers the splashscreen automatically.

Thanks

samuelhenshaw2020 avatar Jan 18 '23 13:01 samuelhenshaw2020

incase anybody still facing the issue this Answer might help you

Solution Add the below code in your AppDelegate.m file's didFinishLaunchingWithOptions method even before calling [RNSplashScreen show];

Explaination: Below code is from RNSplashScreen.m file

`+ (void)show { if (!addedJsLoadErrorObserver) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jsLoadError:) name:RCTJavaScriptDidFailToLoadNotification object:nil]; addedJsLoadErrorObserver = true; }

while (waiting) {
    NSDate* later = [NSDate dateWithTimeIntervalSinceNow:0.1];
    [[NSRunLoop mainRunLoop] runUntilDate:later];
}

}`

You can notice while(waiting) is an infinite loop which runs every 0.1 second until RCTRootView *rootView is available

akshay-engage avatar Mar 13 '24 09:03 akshay-engage