I get the following error after adding react-native-unimodules when running react-native run-ios. I tried building the project on Xcode as well, but I still get errors. I followed the react-native-unimodules install configuration. On android project works fine.
any help is welcome!
error: include of non-modular header inside framework module 'UMReactNativeAdapter.UMViewManagerAdapterClassesRegistry': '/Users/danie
info lmorbeck/Documents/Start-you-up/app-multas-br/ios/build/multasbr/Build/Products/Debug-iphonesimulator/include/React/RCTViewManager.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import <React/RCTViewManager.h>
^
While building module 'UMReactNativeAdapter' imported from /Users/danielmorbeck/Documents/Start-you-up/app-multas-br/ios/multasbr/AppDelegate.h:9:
In file included from <module-includes>:1:
In file included from /Users/danielmorbeck/Documents/Start-you-up/app-multas-br/ios/build/multasbr/Build/Products/Debug-iphonesimulator/UMReactNativeAdapter/UMReactNativeAdapter.framework/Headers/UMReactNativeAdapter-umbrella.h:21:
/Users/danielmorbeck/Documents/Start-you-up/app-multas-br/ios/build/multasbr/Build/Products/Debug-iphonesimulator/UMReactNativeAdapter/UMReactNativeAdapter.framework/Headers/UMViewManagerAdapter.h:3:9: error: include of non-modular header inside framework module 'UMReactNativeAdapter.UMViewManagerAdapter': '/Users/danielmorbeck/Documents/Start-you-up/app-multas-br/ios/build/multasbr/Build/Products/Debug-iphonesimulator/include/React/RCTViewManager.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import <React/RCTViewManager.h>
^
6 errors generated.
In file included from /Users/danielmorbeck/Documents/Start-you-up/app-multas-br/ios/multasbr/main.m:10:
/Users/danielmorbeck/Documents/Start-you-up/app-multas-br/ios/multasbr/AppDelegate.h:9:9: fatal error: could not build module 'UMReactNativeAdapter'
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
~~~~~~~^
7 errors generated.
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening multasbr.xcworkspace
** BUILD FAILED **
The following build commands failed:
CompileC /Users/danielmorbeck/Documents/Start-you-up/app-multas-br/ios/build/multasbr/Build/Intermediates.noindex/multasbr.build/Debug-iphonesimulator/multasbr.build/Objects-normal/x86_64/main.o /Users/danielmorbeck/Documents/Start-you-up/app-multas-br/ios/multasbr/main.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
this is my Podfile
platform :ios, '10.0'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
target 'multasbr' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for multasbr
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
'RCTAnimation',
'RCTImage',
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
use_unimodules!
target 'multasbr-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'multasbrTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'multasbr-tvOS' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for multasbr-tvOS
end
my AppDelegate.h
#import <React/RCTBridgeDelegate.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
@property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
@property (nonatomic, strong) UIWindow *window;
@end
AppDelegate.m
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <UMCore/UMModuleRegistry.h>
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
@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:@"multasbr"
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];
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
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end