世博会更新 - 无法下载新更新

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

我正在尝试使用 EAS 构建将 OTA 更新添加到我的世博应用程序中,只要自定义服务器即可,以避免使用世博中的 EAS 更新付费功能,但我遇到了问题。 (我从

https://github.com/expo/custom-expo-updates-server
复制粘贴了 expo-updates-server 文件夹)

使用 EAS 更新时,一切都按预期运行,但我很快就达到了 1000 次免费更新限制。

这是我的

updates
中的
app.json
部分以及我如何配置
runtimeVersion

https://custom-domain.com/api/manifest 仅托管来自 github 的 expo-updates-server。

app.json

...
"updates": {
  "enabled": true,
  "checkAutomatically": "ON_LOAD",
  "url": "https://custom-domain.com/api/manifest",
  "codeSigningCertificate": "./code-signing/certificate.pem",
  "codeSigningMetadata": {
    "keyid": "main",
    "alg": "rsa-v1_5-sha256"
  }
},
"runtimeVersion": {
  "policy": "sdkVersion"
}
...

在我的 App.tsx 中,我也有这个来收听任何更新并尝试下载它。

useEffect(() => {
  checkForUpdates();
}, []);

async function checkForUpdates() {
  try {
    const update = await Updates.checkForUpdateAsync();
    if (update.isAvailable) {
      await Updates.fetchUpdateAsync();       ---> causes the error
      await Updates.reloadAsync();
    }
  } catch (err) {
    console.log(err);
  }
}

我还设置了 Sentry 来跟踪应用程序上的任何错误,每次运行新更新时,应用程序都会尝试通过调用我的更新网址来获取它,它会告诉我错误来自

await Updates.fetchUpdateAsync();

我还有一个

eas.json
配置文件:

{
  "cli": {
    "version": ">= 3.1.1"
  },
  "build": {
    "development": {
      "channel": "development",
      "developmentClient": true,
      "distribution": "internal"
    },
    "staging": {
      "distribution": "internal",
      "channel": "staging",
      "env": {
        "API_URL": "https://staging.domain.com",
        "EXPO_APPLE_ID": "APPLE_ID"
      }
    },
  }
}

以下是从构建到更新的流程:

  1. 构建应用程序:运行

    eas build -p ios --profile staging
    。这将转到
    expo.dev
    仪表板。一切正常,构建完成后我可以通过二维码将应用程序下载到我的设备上。

  2. 对我的应用程序进行一些更改(更改标题或类似的内容)

  3. 从服务器创建更新:在

    https://github.com/expo/custom-expo-updates-server
    npm run expo-publish
    文件夹中运行 expo-updates-server。这将转到我的客户端文件夹,运行 expo export --experimental-bundle 并将
    dist
    文件夹复制到服务器中的
    /updates
    文件夹。

  4. 强制退出应用程序并重新启动它后,一个请求发送到我的自定义服务器,

    checkForUpdateAsync()
    通过,但
    fetchUpdateAsync()
    失败,我在Sentry上得到
    "Failed to download new update"

react-native expo ota eas expo-updates
1个回答
0
投票

我就遇到过这个问题。有更新吗?

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