【问题标题】:expo-updates not updating internal distributionexpo-updates 不更新内部分发
【发布时间】:2023-01-12 18:15:09
【问题描述】:

试图实施expo-updates,我有点难过。我有一个部署、通道和分支都称为“测试”。我为两个操作系统构建了良好的内部分发版本,并且可以验证应用程序配置是否具有 updates.url。我有一个成功运行的eas update --channel testing,它显示在 UI 中的“更新”下并链接到“测试”分支和频道。

我已经强制退出该应用程序十几次了,但仍然看不到更新。我是否必须在代码库中实现一些东西才能“接受”,或者 Expo 会自动处理这个问题?

eas.json部分:

{
  ...
  "build": {
    "testing": {
      "channel": "testing",
      "distribution": "internal",
    },
    ...
  },
  ...
}

Expo Build输出部分:

{
  "runtimeVersion": {
    "policy": "sdkVersion"
  },
  "updates": {
    "url": "https://u.expo.dev/<projectId>"
  },
  ...
}

【问题讨论】:

    标签: expo expo-updates


    【解决方案1】:

    我最终不得不做这样的事情来让更新工作:

      useEffect(() => {
        if (!__DEV__) {
          async function checkForUpdates() {
            let update: Updates.UpdateCheckResult;
            try {
              update = await Updates.checkForUpdateAsync();
            } catch (e) {
              throw new Error('Error checking for updates', e);
            }
            if (update.isAvailable) {
              setLoading(true);
              try {
                const fetchResult = await Updates.fetchUpdateAsync();
                setIsNew(fetchResult.isNew);
              } catch (e) {
                setLoading(false);
                throw new Error('Error fetching updates', e);
              }
    
              try {
                await Updates.reloadAsync();
              } catch (e) {
                setLoading(false);
                throw new Error('Error reloading app', e);
              }
              setLoading(false);
            }
          }
          checkForUpdates();
        }
      }, []);
    

    【讨论】:

      猜你喜欢
      • 2022-06-13
      • 2019-10-14
      • 1970-01-01
      • 1970-01-01
      • 2016-11-02
      • 2016-06-10
      • 1970-01-01
      • 2019-12-14
      • 2021-07-27
      相关资源
      最近更新 更多