React Native iOS - Hermes 在 Podfile 中启用,但在应用程序中未启用

问题描述 投票:0回答:2

我正在尝试在 iOS 版 React Native 0.65 应用程序中启用 Hermes。我已按照文档对我的 Podfile 进行以下更改来启用 Hermes:

use_react_native!(
     :path => config[:reactNativePath],
     # to enable hermes on iOS, change `false` to `true` and then install pods
-    :hermes_enabled => false
+    :hermes_enabled => true
   )

然后我清理了构建文件夹,运行

pod install
,并在调试模式下为物理 iOS 设备重新构建了我的应用程序。但是,在我的应用程序中运行 React Native 提供的以下代码显示 Hermes 实际上已被禁用:

const isHermes = () => !!global.HermesInternal; // <-- returns false

如何在我的应用程序中启用 Hermes?我正在运行 React Native 0.65.1,最近从 0.64.2 升级。谢谢你。

javascript ios react-native cocoapods react-native-hermes
2个回答
0
投票

我也遇到了同样的问题。您必须在设备/模拟器上卸载应用程序,然后从 xcode 重建。


-1
投票

您检查过

undefined
值吗?输入
!!
将计算为布尔值。

© www.soinside.com 2019 - 2024. All rights reserved.