React-Native:在生产版本中启用性能监视器 [英] React-Native: Enable Performance Monitor in production build
问题描述
我正在为 iOS 进行 react-native 自动化 UI 测试,我想从性能监视器中获取 UI 和 JS FPS.
I am working on react-native automated UI test for iOS and I want to get the UI and JS FPS from the performance monitor.
我可以在调试模式下启用并获取这些值,但在生产模式下,即使我更新设置以在 AppDelegate 中强制启用,我也无法启用性能监视器
I can enable and get those value in debug mode, but in production mode I cannot enable the performance monitor even I update the settings to force enable in AppDelegate
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *settings = [defaults objectForKey:@"RCTDevMenu"];
NSMutableDictionary *newSettings = [NSMutableDictionary dictionaryWithDictionary:settings];
newSettings[@"RCTPerfMonitorKey"] = @1;
newSettings[@"showFPS"] = @1;
[defaults setObject:newSettings forKey:@"RCTDevMenu"];
[defaults synchronize];
有没有办法在生产版本中打开性能监视器?
Are there any ways to open the performance monitor in production build?
推荐答案
发现我们可以在 React.xcodeproj 中创建一个新模式并在 Preprocessor Marcos 中设置 RCT_DEV=1 以启用开发菜单,即使在生产构建中.
Found out that we can create a new schema in React.xcodeproj and set the RCT_DEV=1 in Preprocessor Marcos to enable the development menu even in production build.
这篇关于React-Native:在生产版本中启用性能监视器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!