【问题标题】:Pulling Device Info from mobile application从移动应用程序中提取设备信息
【发布时间】:2018-12-21 06:41:33
【问题描述】:

我有以下代码:

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() 但这似乎也不是很好。

【问题讨论】:

    标签: typescript react-native mobile device info


    【解决方案1】:

    DeviceInfo.getSystemVersion() 应该为您提供设备的操作系统版本。 https://github.com/rebeccahughes/react-native-device-info#getsystemversion

    【讨论】:

      猜你喜欢
      • 2019-08-21
      • 2016-12-17
      • 1970-01-01
      • 1970-01-01
      • 2017-01-03
      • 2014-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多