我有以下代码:
import { put } from "redux-saga/effects"
import { actions, AppStrings } from "common"
const DeviceInfo = require("react-native-device-info")
interface CheckIosVersionAction {
readonly type: "CHECK_IOS_VERSION"
readonly buildNumber: number
readonly systemName: string
}
export function* checkIosVersion(action: CheckIosVersionAction): {} {
if (DeviceInfo.getSystemName() !== "iOS") {
return
}
const deviceBuildNumber = parseInt(DeviceInfo.getBuildNumber(), 10)
if (action.buildNumber > deviceBuildNumber) {
yield put(
actions.receiveError(AppStrings.AppStrings.landing.invalidVersion),
)
}
}
我正在尝试将设备版本添加到信息负载中。我让应用程序版本正常运行,但我无法让设备版本正常运行。我想在最后添加DeviceInfo.getVersion((,但效果似乎也不太好。
DeviceInfo.getSystemVersion()
应提供设备的操作系统版本。https://github.com/rebeccahughes/react-native-device-info#getsystemversion