Updates seems having problems on ios

Hi,

I use Expo v34.0.3 to build my app and host it on my server. Now I find that using the same network, android app updates quickly but ios app is stuck. When I use Expo v30, the function is just fine according to my users. I wonder if anyone is facing the same problem. Is there a probable solution without version rollback?

My system infos below.

macOS Mojave: 10.14.6
npm: 6.10.2
node: 10.16.0
expo-cli: 3.0.8

My package.json related parts below.

{
  ...,
  "dependencies": {
    "axios": "^0.19.0",
    "color": "^3.1.2",
    "expo": "^34.0.3",
    "expo-barcode-scanner": "~6.0.0",
    "expo-camera": "~6.0.0",
    "expo-constants": "~6.0.0",
    "expo-font": "~6.0.1",
    "expo-location": "~6.0.0",
    "expo-permissions": "~6.0.0",
    "expo-web-browser": "~6.0.0",
    "lodash": "^4.17.15",
    "mobx": "^5.13.0",
    "mobx-react": "^5.4.4",
    "moment": "^2.24.0",
    "native-base": "^2.12.1",
    "react": "16.8.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
    "react-native-datepicker": "1.7.2",
    "react-native-gesture-handler": "~1.3.0",
    "react-native-reanimated": "~1.1.0",
    "react-navigation": "2.18.3"
  }
}

My app.json related parts below.

{
  "expo": {
    "name": "...",
    "description": "...",
    "slug": "...",
    "sdkVersion": "34.0.0",
    "version": "1.0.5",
    "orientation": "portrait",
    "primaryColor": "#cccccc",
    "icon": "...",
    "assetBundlePatterns": [
      "assets/fonts/*",
      "assets/img/*"
    ],
    "androidStatusBar": {
      "barStyle": "light-content",
      "backgroundColor": "#334393"
    },
    "splash": {
      "backgroundColor": "#FFEF02",
      "resizeMode": "contain",
      "image": "..."
    },
    "updates": {
      "enabled": true,
      "checkAutomatically": "ON_ERROR_RECOVERY",
      "fallbackToCacheTimeout": 0
    },
    "ios": {
      "bundleIdentifier": "...",
      "buildNumber": "1.0.5",
      "infoPlist": {
        "NSCameraUsageDescription": "...",
        "NSLocationWhenInUseUsageDescription": "..."
      }
    },
    "android": {
      "package": "...",
      "versionCode": 10005
    }
  }
}

My related codes below.

const res = await Promise.race([
  Updates.checkForUpdateAsync(),
  new Promise((resolve, reject) => {
    setTimeout(() => {
      reject(new Error('Timeout!'));
    }, 10000);
  }),
]);
// check update successfully in 10s
if (res.isAvailable) {
  // get version and updtInfo
  const { version: newVersion, updtInfo = 'No update Info' } = res.manifest;
  // get update time
  let date = res.manifest.publishedTime;
  date = date.substring(0, date.indexOf('T'));
  // compare versions, check if breaking update
  const newVersionArr = newVersion.split('.').map(ele => parseInt(ele, 10));
  if (newVersionArr[0] !== [1, 0, 5][0]) {
    // breaking update
    if (Platform.OS === 'ios') {
      // alert hint
      Alert.alert(...);
    } else {
      // alert hint
      Alert.alert(...);
    }
  } else {
    // alert hint
    Alert.alert(
      'Hint', `Please wait for update and reload automatically.\r\nPublishedTime:${date}\r\nVersion:${newVersion}\r\nVersionInfo${updtInfo}`,
      [{ text: 'OK', onPress: () => {} }],
      { cancelable: false, onDismiss: () => {} },
    );
    // stuck below and never reload
    Updates.fetchUpdateAsync()
      .then(() => { Updates.reloadFromCache(); });
  }
}

Thanks!

Using Charles, I found that my app did download files (ios-index.json and bundles/ios-46f22f9a0236b5cb22c3768c67a3fe40.js, status code 200) but didn’t reload.

But the same code worked on Android. What is the problem? Please help.

Is there any solution please? :frowning:

Hey @qyw, Could you share a repro of this with me? I haven’t seen this problem with SDK 34 so I think it might be something specific in your setup

Hey @charliecruzan. I am sorry that I can’t, cause it is a business project and I find this problem when the app is distributed. I can only show you some codes. Maybe you can tell me what you need for debugging? I will show you if I can.

I have also submitted an issue on github, maybe you can get more infos there?

Thanks.

Taking a look at that issue now, we’ll continue the conversation over there :+1:

Thanks a lot.

I’m impressed you were able to upgrade from Expo 30 to 34. I’m really struggling. :yum:

Expo 34 used a better version of React Native, and gave some new features. I think 34 is better than 30 :smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.