react-native-unimodules app crash on iOS

Hello,

I ejected the code from expo in order to use expo-in-app-purchases. I followed the instructions to install react-native-unimodules but I end up having a crash with this error:

2020-06-10 12:25:01.198724+0200 kisschatproudchat[3603:274364] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
2020-06-10 12:25:01.201207+0200 kisschatproudchat[3603:274364] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2020-06-10 12:25:01.893 [info][tid:main][RCTRootView.m:294] Running application kisschatandproudchat ({
    initialProps =     {
    };
    rootTag = 1;
})
2020-06-10 12:25:01.898814+0200 kisschatproudchat[3603:274364] -[AppDelegate setWindow:]: unrecognized selector sent to instance 0x600000084c40
2020-06-10 12:25:02.007278+0200 kisschatproudchat[3603:274364] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate setWindow:]: unrecognized selector sent to instance 0x600000084c40'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010a4aff0e __exceptionPreprocess + 350
	1   libobjc.A.dylib                     0x000000010997a9b2 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010a4d0c34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   UIKitCore                           0x000000011e568b74 -[UIResponder doesNotRecognizeSelector:] + 302
	4   kisschatproudchat                   0x0000000106e1fcf6 -[UMAppDelegateWrapper forwardInvocation:] + 390
	5   CoreFoundation                      0x000000010a4b46b6 ___forwarding___ + 838
	6   CoreFoundation                      0x000000010a4b6bf8 _CF_forwarding_prep_0 + 120
	7   kisschatproudchat                   0x000000010697efcb -[AppDelegate application:didFinishLaunchingWithOptions:] + 667
	8   UIKitCore                           0x000000011e530698 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 232
	9   UIKitCore                           0x000000011e532037 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3985
	10  UIKitCore                           0x000000011e537bf9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1226
	11  UIKitCore                           0x000000011dc4025d -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
	12  UIKitCore                           0x000000011e14bcc1 _UIScenePerformActionsWithLifecycleActionMask + 83
	13  UIKitCore                           0x000000011dc40d6f __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
	14  UIKitCore                           0x000000011dc4077e -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 296
	15  UIKitCore                           0x000000011dc40b9c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 818
	16  UIKitCore                           0x000000011dc40431 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
	17  UIKitCore                           0x000000011dc44a22 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 178
	18  UIKitCore                           0x000000011e061dad +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 852
	19  UIKitCore                           0x000000011e16a41e _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240
	20  UIKitCore                           0x000000011dc4473d __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 153
	21  UIKitCore                           0x000000011e16a321 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84
	22  UIKitCore                           0x000000011dc445ab -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 381
	23  UIKitCore                           0x000000011da98fa8 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 657
	24  UIKitCore                           0x000000011da97b67 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 253
	25  UIKitCore                           0x000000011da98cd2 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 210
	26  UIKitCore                           0x000000011e536141 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 512
	27  UIKitCore                           0x000000011e0888dc -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
	28  FrontBoardServices                  0x000000010eeb1d2e -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 419
	29  FrontBoardServices                  0x000000010eed7dc1 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
	30  FrontBoardServices                  0x000000010eebc757 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
	31  FrontBoardServices                  0x000000010eed7a52 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
	32  libdispatch.dylib                   0x000000010e300e8e _dispatch_client_callout + 8
	33  libdispatch.dylib                   0x000000010e303da2 _dispatch_block_invoke_direct + 300
	34  FrontBoardServices                  0x000000010eefd6e9 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
	35  FrontBoardServices                  0x000000010eefd3d7 -[FBSSerialQueue _queue_performNextIfPossible] + 441
	36  FrontBoardServices                  0x000000010eefd8e6 -[FBSSerialQueue _performNextFromRunLoopSource] + 22
	37  CoreFoundation                      0x000000010a413d31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	38  CoreFoundation                      0x000000010a413c5c __CFRunLoopDoSource0 + 76
	39  CoreFoundation                      0x000000010a413434 __CFRunLoopDoSources0 + 180
	40  CoreFoundation                      0x000000010a40e02e __CFRunLoopRun + 974
	41  CoreFoundation                      0x000000010a40d944 CFRunLoopRunSpecific + 404
	42  GraphicsServices                    0x000000010f74fc1a GSEventRunModal + 139
	43  UIKitCore                           0x000000011e5399ec UIApplicationMain + 1605
	44  kisschatproudchat                   0x000000010697f3c0 main + 112
	45  libdyld.dylib                       0x000000010e38c1fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
  • Podfile
platform :ios, '10.0'

require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'kisschatandproudchat' do
  rnPrefix = "../node_modules/react-native"

  # React Native and its dependencies
  pod 'FBLazyVector', :path => "#{rnPrefix}/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "#{rnPrefix}/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "#{rnPrefix}/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "#{rnPrefix}/Libraries/TypeSafety"
  pod 'React', :path => "#{rnPrefix}/"
  pod 'React-Core', :path => "#{rnPrefix}/"
  pod 'React-CoreModules', :path => "#{rnPrefix}/React/CoreModules"
  pod 'React-RCTActionSheet', :path => "#{rnPrefix}/Libraries/ActionSheetIOS"
  pod 'React-RCTAnimation', :path => "#{rnPrefix}/Libraries/NativeAnimation"
  pod 'React-RCTBlob', :path => "#{rnPrefix}/Libraries/Blob"
  pod 'React-RCTImage', :path => "#{rnPrefix}/Libraries/Image"
  pod 'React-RCTLinking', :path => "#{rnPrefix}/Libraries/LinkingIOS"
  pod 'React-RCTNetwork', :path => "#{rnPrefix}/Libraries/Network"
  pod 'React-RCTSettings', :path => "#{rnPrefix}/Libraries/Settings"
  pod 'React-RCTText', :path => "#{rnPrefix}/Libraries/Text"
  pod 'React-RCTVibration', :path => "#{rnPrefix}/Libraries/Vibration"
  pod 'React-Core/RCTWebSocket', :path => "#{rnPrefix}/"
  pod 'React-Core/DevSupport', :path => "#{rnPrefix}/"
  pod 'React-cxxreact', :path => "#{rnPrefix}/ReactCommon/cxxreact"
  pod 'React-jsi', :path => "#{rnPrefix}/ReactCommon/jsi"
  pod 'React-jsiexecutor', :path => "#{rnPrefix}/ReactCommon/jsiexecutor"
  pod 'React-jsinspector', :path => "#{rnPrefix}/ReactCommon/jsinspector"
  pod 'ReactCommon/callinvoker', :path => "#{rnPrefix}/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "#{rnPrefix}/ReactCommon"
  pod 'Yoga', :path => "#{rnPrefix}/ReactCommon/yoga", :modular_headers => true
  pod 'DoubleConversion', :podspec => "#{rnPrefix}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rnPrefix}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rnPrefix}/third-party-podspecs/Folly.podspec"

  # from https://github.com/expo/expo/tree/master/packages/@unimodules/react-native-adapter#ios
  pod 'UMReactNativeAdapter', path: '../node_modules/@unimodules/react-native-adapter/ios', inhibit_warnings: true

  # Other native modules

  # Automatically detect installed unimodules
  use_unimodules!

  # react-native-cli autolinking
  use_native_modules!
end
  • AppDelegate.m
#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <UMCore/UMModuleRegistry.h>
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>

@interface AppDelegate () <RCTBridgeDelegate>

// http://openkb.fr/Ios_-_attribute_must_be_readwrite_while_its_primary_must_be_read_only
@property (nonatomic, readwrite, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"kisschatandproudchat" 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];

  [super application:application didFinishLaunchingWithOptions:launchOptions];
  return YES;
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
  NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
  // You can inject any extra modules that you would like here, more information at:
  // https://facebook.github.io/react-native/docs/native-modules-ios.html#dependency-injection
  return extraModules;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
#ifdef DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end
  • AppDelegate.h
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import <UIKit/UIKit.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
#import <React/RCTBridgeDelegate.h>
#import <UMCore/UMAppDelegateWrapper.h>

#import <EXUpdates/EXUpdatesAppController.h>

/*
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
@interface AppDelegate : UMAppDelegateWrapper <RCTBridgeDelegate, EXUpdatesAppControllerDelegate>
*/

@interface AppDelegate : UMAppDelegateWrapper <UIApplicationDelegate, RCTBridgeDelegate>

// http://openkb.fr/Ios_-_attribute_must_be_readwrite_while_its_primary_must_be_read_only
@property (nonatomic, readonly, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
@property (nonatomic, strong) UIWindow *window;

@end

I solved it by creating a new bare project from expo-cli and copy/paste the relevant files in my project