我生成了一个新的基于 ignite 的 react-native 项目。我正在使用 react-native 0.67.2。我在 M1 MacBook 上运行它。
我尝试使用 . 添加库yarn add react-native-localize
,安装 pod 并使用 npx react-native run-ios
. 我收到一个错误
** BUILD FAILED **
The following build commands failed:
CompileC /Users/mehdi/Library/Developer/Xcode/DerivedData/PlanoApp-dzkqtxezzhcxpfgviagpdxmiuhcz/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-CoreModules.build/Objects-normal/x86_64/RCTActionSheetManager.o /Users/mehdi/git/PlanoApp/node_modules/react-native/React/CoreModules/RCTActionSheetManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-CoreModules' from project 'Pods')
(1 failure)
是不是M1相关的问题?我只使用一次库来获取可用语言,是否有使用该库的替代方法?
import * as RNLocalize from "react-native-localize"
import i18n from "i18n-js"
const en = require("./en")
const ja = require("./ja")
i18n.fallbacks = true
i18n.translations = { en, ja }
const fallback = { languageTag: "en", isRTL: false }
const { languageTag } =
RNLocalize.findBestAvailableLanguage(Object.keys(i18n.translations)) || fallback
i18n.locale = languageTag