expo: Standalone app doesn't start in offline

Environment

software version
expo 27.0.0
react-native https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz
device iPhone 6s, iPhone 8

exp diagnostics output

screen shot 2018-06-05 at 12 32 49 pm

App’s target is iOS Standalone

Steps to Reproduce

  1. Create new Expo-project

  2. Add this in App.js

import React from 'react'
import { View } from 'react-native'

export default class App extends React.Component {
  render() {
    return <View style={{ flex: 1, backgroundColor: 'mediumspringgreen' }} />
  }
}
  1. Add this in app.json
{
  "expo": {
    "name": "test",
    "description": "",
    "slug": "test",
    "scheme": "testapp",
    "privacy": "unlisted",
    "sdkVersion": "27.0.0",
    "version": "1.0.0",
    "orientation": "portrait",
    "platforms": ["ios"],
    "primaryColor": "#cccccc",
    "icon": "./assets/icons/app-icon.png",
    "splash": {
      "image": "./assets/img/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "buildNumber": "1",
      "supportsTablet": true,
      "bundleIdentifier": "<your_indentifier>",
      "config": {
        "usesNonExemptEncryption": false
      }
    },
    "android": {
      "package": "<your_indentifier>"
    }
  }
}
  1. Run exp build:ios

  2. Upload build to iTunes Connect

  3. Install app on your phone with TestFlight

  4. Turn off wifi

  5. Open the app

You will see splash screen and app will stall like this.

Expected Behavior

App should start in offline without any problems.

Actual Behavior

When you start app in offline you see splash screen and that’s all.

Reproducible Demo

No demo. In Simulator all works fine when I disable network on my Mac. I tried with and without “Development mode” in Simulator and everything works fine. The problem is only with standalone app.

@brentvatne, @aalices please fix it.

We have spent much time to implement network independent start for our users. Our app should start and look the same independent from network connection. It was working in Expo 26.

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 58 (30 by maintainers)

Most upvoted comments

Hi all – I’m looking into this now. We should have a fix ready soon. Really sorry about this!!

@msevestre I built today and offline start works in our app too. Thanks for your help with this bug!

@serhiipalash I can confirm that my demo app (very simple app) now works online and offline consistently with this fix.

Did the fix make it into the new release?

I am building it right now. I’ll let you know in one hour.

@sebastian-schlecht we have default Expo app and I tried to set

"checkAutomatically": "ON_LOAD"
"falbackToCacheTimeout":1

I explicitly set “checkAutomatically” to “ON_LOAD”. It didn’t help.

I actually didn‘t resort to that because I really wanted to keep OTA updates enabled. It provides a lot of flexibility to us in terms of deployment.

On 7. Jun 2018, at 23:22, Serhii Palash notifications@github.com wrote:

Thanks!

{ “updates”: { /* If set to false, your standalone app will never download any code. And will only use code bundled locally on the device. In that case, all updates to your app must be submitted through Apple review. Defaults to true.

  Note that this will not work out of the box with ExpoKit projects.
*/
"enabled": BOOLEAN,

/* 
  By default, Expo will check for updates every time the app is loaded.
  Set this to `'ON_ERROR_RECOVERY'` to disable automatic checking unless recovering from an error.

  Must be one of `ON_LOAD` or `ON_ERROR_RECOVERY`. 
*/
"checkAutomatically": STRING,

/* 
  How long (in ms) to allow for fetching OTA updates before falling back to a cached version of the app. 

  Defaults to 30000 (30 sec). Must be between 0 and 300000 (5 minutes). 
*/
"fallbackToCacheTimeout": NUMBER

} } Can you try to set?

“updates”: { “enabled”: false, } or

“updates”: { “checkAutomatically”: “ON_ERROR_RECOVERY”, } — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

What I already tried was to not use the update property at all. I did not set fallbackToCacheTimeout to a non-zero value though. As to the former - no success. Still didn’t work.

Experiencing the same issue with pretty much the same config as described above. Using a HTTP proxy, one can see that the app makes a call to exp.host when starting. Disabling the proxy makes the app stop working. However, redirecting or terminating that request (such that 400 is returned for example) makes the app work again.

Hey all, this week’s release included the fix for this regression. If you’re seeing a problem with your standalone app not starting offline, please rebuild the native binary and try again.

Going to close this thread because it’s difficult to tell what’s going on at this point. If you think you found a new issue, feel free to open a new thread. Thanks!

@msevestre

it is not possible to load an expo app on iOS while offline.

Yes, it is. If you use Expo AppLoading component your app will not start in offline on iOS.

For example, we detect device locale before we show the app to the user. Until device locale is detected we need to show some loader screen and we use Expo AppLoading component for it.

The problem is that Expo AppLoading component doesn’t work in offline. We pass in it promise that detects locale or any other promise, but the result is always the same - promise was resolved but AppLoading is still there, onFinish never fires in offline.

To summarize, it is not possible to load an expo app on iOS while offline. It happens not only the first time the app is started but every time? Is this correct?