Skip to content

Commit 7786805

Browse files
Kudofacebook-github-bot
authored andcommittedMar 27, 2025
fix React-jsitooling build error for use_frameworks build (#50252)
Summary: to resolve use_frameworks build error. this is an edge case happening only when there's objective-c files import to `React_RCTAppDelegate`. Xcode will have `include of non-modular header inside framework module` error originally. this is the generated umbrella header for jsitooling is incorrect. even the header path are correct, they are not modular headers. ~this pr adds a workaround to import header from outside the module.~ updates: this pr uses a forward declaration to prevent exposing the dependency in umbrella header. ## Changelog: [IOS] [FIXED] - `JSRuntimeFactoryCAPI.h` build error for `use_frameworks` build Pull Request resolved: #50252 Test Plan: to reproduce the build error, we can build `USE_FRAMEWORKS=static bundle exec pod install` from rn-tester. we also need to import `React_RCTAppDelegate` from objective-c files. in this case, we can add `import React_RCTAppDelegate;` in rn-tester's main.m ```diff --- a/packages/rn-tester/RNTester/main.m +++ b/packages/rn-tester/RNTester/main.m @@ -8,6 +8,9 @@ #import <UIKit/UIKit.h> #import "AppDelegate.h" +@import React_RCTAppDelegate; +// This also triggers the error +//#import <React_RCTAppDelegate/React-RCTAppDelegate-umbrella.h> int main(int argc, char *argv[]) { ``` Reviewed By: fabriziocucci Differential Revision: D71963188 Pulled By: cipolleschi fbshipit-source-id: 5d566ae5aadb9efc032aacfe32862ea289134f87
1 parent 041014b commit 7786805

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed
 

‎packages/react-native/Libraries/AppDelegate/RCTJSRuntimeConfiguratorProtocol.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import <UIKit/UIKit.h>
9-
#import <react/runtime/JSRuntimeFactoryCAPI.h>
10-
118
#pragma once
129

1310
NS_ASSUME_NONNULL_BEGIN
1411

12+
// Forward declarations for umbrella headers.
13+
// In implementations, import `<react/runtime/JSRuntimeFactoryCAPI.h>` to obtain the actual type.
14+
typedef void *JSRuntimeFactoryRef;
15+
1516
@protocol RCTJSRuntimeConfiguratorProtocol
1617

1718
- (JSRuntimeFactoryRef)createJSRuntimeFactory;

‎packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
3333
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
3434
#import <react/runtime/JSRuntimeFactory.h>
35+
#import <react/runtime/JSRuntimeFactoryCAPI.h>
3536

3637
@implementation RCTRootViewFactoryConfiguration
3738

‎packages/react-native/ReactCommon/jsitooling/React-jsitooling.podspec

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ Pod::Spec.new do |s|
3333
s.header_mappings_dir = "./"
3434
end
3535

36-
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard() }
36+
s.pod_target_xcconfig = {
37+
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
38+
"DEFINES_MODULE" => "YES",
39+
}
3740

3841
s.dependency "React-cxxreact", version
3942
s.dependency "React-jsi", version

‎packages/react-native/ReactCommon/jsitooling/react/runtime/JSRuntimeFactory.h

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#pragma once
99

10+
#ifdef __cplusplus
11+
1012
#include <ReactCommon/RuntimeExecutor.h>
1113
#include <cxxreact/MessageQueueThread.h>
1214
#include <jsi/jsi.h>
@@ -72,3 +74,5 @@ class JSIRuntimeHolder : public JSRuntime {
7274
};
7375

7476
} // namespace facebook::react
77+
78+
#endif // __cplusplus

0 commit comments

Comments
 (0)