HwangTaehyun / react-native-lottie-splash-screen

⚡ Lottie splash screen for your react native app!
MIT License
222 stars 62 forks source link

iOS Swift file not found #4

Closed girish54321 closed 3 years ago

girish54321 commented 3 years ago

Run react-native info in your project and share the content. info Fetching system and libraries information... (node:22236) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Usenode --trace-warnings ...to show where the warning was created) System: OS: macOS 11.1 CPU: (16) x64 Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz Memory: 26.45 MB / 8.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.15.5 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.5.4 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.6953283 Xcode: 12.3/12C33 - /usr/bin/xcodebuild Languages: Java: 15.0.1 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.4 => 0.63.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found What react-native-splash-screen version are you using? "react-native-splash-screen": "^3.2.0", What platform does your issue occur on? (Android/iOS/Both) Both Describe your issue as precisely as possible : 1) I folled the dosc for iOS but its says #import "AwesomeProject-Swift.h" not found is XCode 2)

Join a screenshot or video of the problem on the simulator or device?

Screenshot 2021-03-13 at 11 51 02 AM Screenshot 2021-03-13 at 11 51 47 AM Screenshot 2021-03-13 at 11 56 23 AM Screenshot 2021-03-13 at 11 57 19 AM

Show us the code you are using?

HwangTaehyun commented 3 years ago

I think I had a similar problem in the past. Have you tried the solutions of the stack overflow articles below?

https://stackoverflow.com/questions/26328034/importing-project-swift-h-into-a-objective-c-class-file-not-found https://stackoverflow.com/questions/47679450/project-swift-h-file-not-found/47679927

First of all, it would be nice to try the following things first.

  1. Clear derived data.
  2. If the compilation is not done properly, the file(-swift.h) may not be created automatically.

Thank you!

girish54321 commented 3 years ago

@HwangTaehyun ok.

KawaljeetCuelogic commented 3 years ago

@girish54321 Let me know if that worked for you. I am facing the same issue

girish54321 commented 3 years ago

@KawaljeetCuelogic Sure will update the issue.

girish54321 commented 3 years ago

Hi @KawaljeetCuelogic and @HwangTaehyun iOS build is successfully now the splash screen shows up nicely but i want to know how can i remove the default splash view LaunchScreen.storyboard

1) default splash view LaunchScreen.storyboard

2) The react-native-lottie-splash-screen

Incase any one having issues with build this is how your project should look like

Screenshot 2021-03-20 at 1 24 55 PM
HwangTaehyun commented 3 years ago

At first, I have searched many articles about changing ios's LaunchScreen.storyboard with lottie animation. However, Xcode enforces that LaunchScreen.storyboard should be static screen. So, I inserted animation code after static launch screen loading. Maybe, launch screen is essential, because it is loading screen for initial loading resource in ios. If you remove the launch screen, then ios app shows black or white screen at first loading. https://stackoverflow.com/questions/37975826/remove-launch-screen-xcode-7

girish54321 commented 3 years ago

Hi all, closing this issue. all of my issues are resolved now.

KawaljeetCuelogic commented 3 years ago

@girish54321 Be good if you add some pointers on the error we faced about -Swift.h file not found issue. How were you able to overcome this?

girish54321 commented 3 years ago

Hi @KawaljeetCuelogic when you create the .swift file xcode well ask you to create Bridging-Header.h say YES there. and for "No such module 'Lottie'" error I didyarn add lottie-react-native and cd ios && pod install and after that build successfully 🎉🥂 .

my project link note :.json is missing in the repo for iOS

KawaljeetCuelogic commented 3 years ago

@girish54321 Where in the code should we place splash.json lottie file for iOS?

girish54321 commented 3 years ago

@KawaljeetCuelogic loding.json Check the image below

111863134-ab234780-897f-11eb-9c7a-430915570fe7
KawaljeetCuelogic commented 3 years ago

Ok thanks @girish54321 . I am always getting -Swift.h file not found error despite following all your steps. No wonder why? :(

girish54321 commented 3 years ago

@KawaljeetCuelogic have you tried this link

mayfairr commented 3 years ago

Hi, @girish54321 I have seen your Github project but I am still experiencing the following issue: Mobile-Swift.h' file not found.

As well as this in the Dynamic.swift: Cannot find 'RNSplashScreen' in scope

Any suggestions?:

Here is my Dynamic.swift:

import Foundation
import Lottie

@objc class Dynamic: NSObject {

  @objc func createAnimationView(rootView: UIView, lottieName: String) -> AnimationView {
    let animationView = AnimationView(name: lottieName)
    animationView.frame = rootView.frame
    animationView.center = rootView.center
    animationView.backgroundColor = UIColor.white;
    return animationView;
  }

  @objc func play(animationView: AnimationView) {
    animationView.play(
      completion: { (success) in
        RNSplashScreen.setAnimationFinished(true)
      } 
    );
  }
}

Here is my Mobile-Bridging-Header.h

#ifndef Mobile_Bridging_Header_h
#define Mobile_Bridging_Header_h

#import "RNSplashScreen.h" // here

#endif /* HyperMoney_Bridging_Header_h */
girish54321 commented 3 years ago

@mayfairr try doing yarn add lottie-react-native after i added this package the error gone and do clean iOS project.

mayfairr commented 3 years ago

@mayfairr try doing yarn add lottie-react-native after i added this package the error gone and do clean iOS project.

Yes the problem with the [projectName]-Swift.h was that the project name was not named correctly. To fix this I simply went to:

[projectName] > Build Settings > All > Swift Compiler General > Objective-C Generated Interface Header Name

girish54321 commented 3 years ago

So Error is gone @mayfairr ?

mayfairr commented 3 years ago

So Error is gone @mayfairr ?

Yes 🚀

girish54321 commented 3 years ago

@mayfairr 😄😄 Nice

phamhieu1412 commented 3 years ago

@mayfairr 😄😄 Nice

i get error: "Undefined symbol: _swift_getOpaqueTypeConformance?" how to fix it?

vinay-sayone commented 2 years ago

@girish54321 How do you remove the default splashscreen ?

girish54321 commented 2 years ago

We can't remove @vinay-sayone I have asked @HwangTaehyun here

iamrohitagg commented 1 month ago

I am getting the same error on react-native 0.74.3. I have tried all the solutions mentioned here.