Can you programmatically reload an expo app?

I have to re-initialize a data structure in my expo managed app (SDK 49) so i need to reload the app. Everything works in development (IOS dev build) , i hit a button and the app reloads. But in production, nothing happens. Is there anything i need to do differently in production I’m only using this function to manually reload the app not to deliver any updates just yet. Updates.reloadAsync() from expo-updates i keep getting code ERR_FUNCTION_CALL in production, my code:
setTimeout(() => {

(async () => {
if (__DEV__) {
DevSettings.reload()
return
}
try {
const res = await Updates.reloadAsync()
console.log('res',res)
Alert.alert('res',JSON.stringify(res))
} catch (error) {
Alert.alert('error',JSON.stringify(error))
}
})();

},100);
setTimeout(() => {

(async () => {
if (__DEV__) {
DevSettings.reload()
return
}
try {
const res = await Updates.reloadAsync()
console.log('res',res)
Alert.alert('res',JSON.stringify(res))
} catch (error) {
Alert.alert('error',JSON.stringify(error))
}
})();

},100);
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server