Error in AppDelegate.mm after following plugin integration
See original GitHub issueRun react-native info
in your project and share the content.
System: OS: macOS 10.15.7 CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz Memory: 1.34 GB / 32.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node Yarn: 1.22.5 - /usr/local/bin/yarn npm: 6.14.15 - ~/.nvm/versions/node/v14.17.6/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, 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.4/12D4e - /usr/bin/xcodebuild Languages: Java: 11.0.15 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.1 => 0.68.1 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found
What react-native-splash-screen
version are you using?
0.1.14
What platform does your issue occur on? (Android/iOS/Both)
iOS
Describe your issue as precisely as possible :
I followed the documentation for iOS integration and been stuck on this issue. When i try to run from xcode i get this error.
Cannot initialize a variable of type 'UIView *__strong' with an rvalue of type 'AnimationView *'
Join a screenshot or video of the problem on the simulator or device?
Show us the code you are using?
AppDelegat.mm
file
`#import “AppDelegate.h”
#import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h> #import “RNSplashScreen.h” #import “Quickzy-Swift.h”
#import <React/RCTAppSetupUtils.h> #import <CodePush/CodePush.h>
#if RCT_NEW_ARCH_ENABLED #import <React/CoreModulesPlugins.h> #import <React/RCTCxxBridgeDelegate.h> #import <React/RCTFabricSurfaceHostingProxyRootView.h> #import <React/RCTSurfacePresenter.h> #import <React/RCTSurfacePresenterBridgeAdapter.h> #import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> { RCTTurboModuleManager *_turboModuleManager; RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig; facebook::react::ContextContainer::Shared _contextContainer; } @end #endif
@implementation AppDelegate
-
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { RCTAppSetupPrepareApp(application);
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
#if RCT_NEW_ARCH_ENABLED _contextContainer = std::make_shared<facebook::react::ContextContainer const>(); _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>(); _contextContainer->insert(“ReactNativeConfig”, _reactNativeConfig); _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer]; bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; #endif
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @“Quickzy”, nil);
if (@available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; } else { rootView.backgroundColor = [UIColor whiteColor]; }
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible];
Dynamic *t = [Dynamic new]; UIView *animationView = [t createAnimationViewWithRootView:rootView lottieName:@“loading”]; // change lottieName to your lottie files name animationView.backgroundColor = [UIColor whiteColor]; // change backgroundColor
// register LottieSplashScreen to RNSplashScreen [RNSplashScreen showLottieSplash:animationView inRootView:rootView];
// play [t playWithAnimationView:animationView];
// If you want the animation layout to be forced to remove when hide is called, use this code [RNSplashScreen setAnimationFinished:true];
return YES; }
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@“index”]; #else return [CodePush bundleURL]; #endif }
#if RCT_NEW_ARCH_ENABLED
#pragma mark - RCTCxxBridgeDelegate
- (std::unique_ptrfacebook::react::JSExecutorFactory)jsExecutorFactoryForBridge:(RCTBridge *)bridge { _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge delegate:self jsInvoker:bridge.jsCallInvoker]; return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager); }
#pragma mark RCTTurboModuleManagerDelegate
-
(Class)getModuleClassFromName:(const char *)name { return RCTCoreModulesClassProvider(name); }
-
(std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const std::string &)name jsInvoker:(std::shared_ptrfacebook::react::CallInvoker)jsInvoker { return nullptr; }
-
(std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const std::string &)name initParams: (const facebook::react::ObjCTurboModule::InitParams &)params { return nullptr; }
-
(id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass { return RCTAppSetupDefaultModuleFromClass(moduleClass); }
#endif
@end`
Issue Analytics
- State:
- Created a year ago
- Comments:8 (2 by maintainers)
I did a solution that makes it work by doing some conversion type. I hope that helps you guys @omniviewsports and @dibakr-halder-udaan
Thanks @HwangTaehyun !