Skip to content

Commit 1b88be4

Browse files
IjzerenHeinsasurau4
authored andcommitted
Fix crash when enabling Performance Monitor on iOS 13.4 (facebook#28512)
Summary: This PR fixes a crash when opening the Performance Monitor on iOS 13.4. Detailed info: facebook#28414 ## Changelog `[iOS] [Fixed] - Fix crash when enabling Performance Monitor on iOS 13.4` ## 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 trying to show the GC usage. Pull Request resolved: facebook#28512 Test Plan: Tested on iOS 13.4 (simulator): ![image](https://user-images.githubusercontent.com/6184593/77903803-c6370c00-7283-11ea-8b71-b6b6546c82f6.png) Tested on iOS 13.1 (simulator) ![image](https://user-images.githubusercontent.com/6184593/77903499-41e48900-7283-11ea-9d14-83f67a3b7b77.png) - Verified that the `setOption` was called, but the Performance Monitor didn't show any GC usage regardless. - Identical PR expo#21 has been shipped and tested in Expo Client 37 Fixes facebook#28414 Reviewed By: PeteTheHeat Differential Revision: D20851131 Pulled By: TheSavior fbshipit-source-id: ff96301036e8487db59f95947bbe6841fe230e1e
1 parent ccb17e5 commit 1b88be4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

React/CoreModules/RCTPerfMonitor.mm

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ static BOOL RCTJSCSetOption(const char *option)
4444
static RCTJSCSetOptionType setOption;
4545
static dispatch_once_t onceToken;
4646

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

0 commit comments

Comments
 (0)