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!