Skip to content

Commit 3eeee11

Browse files
Saadnajmifacebook-github-bot
authored andcommitted
Guard JSGlobalContextSetInspectable behind a compile time check for Xcode 14.3+ (#39037)
Summary: An earlier [change](8b1bf05) I made (that huntie resubmitted) only works on Xcode 14.3+ (See more info [here](react-native-community/discussions-and-proposals#687)). This change adds the appropriate compiler checks so that the change is compatible with Xcode 14.2 and earlier, and therefore cherry-pickable to 0.71 and 0.72. The check works by checking if iOS 16.4+ is defined, which is the closest proxy I could find for "Is this Xcode 14.3". ## Changelog: [IOS] [CHANGED] - Guard `JSGlobalContextSetInspectable` behind a compile time check for Xcode 14.3+ Pull Request resolved: #39037 Test Plan: I can't actually test on Xcode 14.2 (it won't launch on my MacBook 😢), but I made a similar [PR](microsoft#1848) in React Native macOS, whose CI checks run against Xcode 14.2 and I'm getting passing checks there. Reviewed By: huntie Differential Revision: D48414196 Pulled By: NickGerleman fbshipit-source-id: ba10a6505dd11d982cc56c02bf9f7dcdc104bbec
1 parent c522837 commit 3eeee11

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-native/ReactCommon/jsc/JSCRuntime.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ class JSCRuntime : public jsi::Runtime {
302302
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
303303
#define _JSC_NO_ARRAY_BUFFERS
304304
#endif
305+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400
306+
#define _JSC_HAS_INSPECTABLE
307+
#endif
305308
#endif
306309
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
307310
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11
@@ -399,7 +402,7 @@ JSCRuntime::JSCRuntime(JSGlobalContextRef ctx)
399402
#endif
400403
{
401404
#ifndef NDEBUG
402-
#ifdef TARGET_OS_MAC
405+
#ifdef _JSC_HAS_INSPECTABLE
403406
if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) {
404407
JSGlobalContextSetInspectable(ctx_, true);
405408
}

0 commit comments

Comments
 (0)