Skip to content

Commit 9ccbad5

Browse files
authored
[ios] Fix crash when enabling Performance Monitor on iOS 13.4
## Motivation This PR fixes a crash when opening the Performance Monitor on iOS 13.4. More info: facebook#28414 ## How This PR prevents the JavaScriptCore option from being set altogether. This ensures that the performance monitor keeps working, but on iOS 13.4 and higher, it will no longer crash or show the GC usage. ## Test Plan Tested on iOS 13.4 (simulator): Tested on iOS 13.1 (simulator) - Verified that the `setOption` was called, but the Performance Monitor didn't show any GC usage regardless. ## Release Notes `[ IOS ] [ BUGFIX ] [RCTPerfMonitor.m] - Fix crash when enabling Performance Monitor on iOS 13.4`
2 parents f5d5c10 + d7e38fd commit 9ccbad5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

React/Profiler/RCTPerfMonitor.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ static BOOL RCTJSCSetOption(const char *option)
4040
static RCTJSCSetOptionType setOption;
4141
static dispatch_once_t onceToken;
4242

43+
// As of iOS 13.4, it is no longer possible to change the JavaScriptCore
44+
// options at runtime. The options are protected and will cause an
45+
// exception when you try to change them after the VM has been initialized.
46+
// https://github.com/facebook/react-native/issues/28414
47+
if (@available(iOS 13.4, *)) {
48+
return NO;
49+
}
50+
4351
dispatch_once(&onceToken, ^{
4452
/**
4553
* JSC private C++ static method to toggle options at runtime

0 commit comments

Comments
 (0)