Black screen in local build IOS app when using expo-dev-client - fresh install

This issue has been created since 2022-01-25.

Summary

When starting an app that uses expo-dev-client from the command line in an iOS simulator, the app opens to a black screen and never connects to the expo dev server. This does not happen if the app is opened by tapping its icon (e.g., not launched with a URL), and it does not happen if expo-dev-client is not installed.

This is a duplicate of #16008.

Managed or bare workflow? If you have made manual changes inside of the ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

iOS

Package versions

Environment

M1 Mac

  Expo CLI 5.0.3 environment info:
    System:
      OS: macOS 12.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 16.13.1 - ~/.local/share/asdf/installs/nodejs/16.13.1/bin/node
      Yarn: 1.22.15 - ~/.local/share/asdf/installs/nodejs/16.13.1/bin/yarn
      npm: 8.1.2 - ~/.local/share/asdf/plugins/nodejs/shims/npm
      Watchman: 2022.01.17.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.11.2 - /Users/jason/.local/share/asdf/installs/ruby/2.7.5/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    IDEs:
      Android Studio: 2020.3 AI-203.7717.56.2031.7935034
      Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~44.0.0 => 44.0.5
      react: 17.0.1 => 17.0.1
      react-dom: 17.0.1 => 17.0.1
      react-native: 0.64.3 => 0.64.3
      react-native-web: 0.17.1 => 0.17.1
    Expo Workflow: bare

Reproducible demo

  1. expo init TestApp, choosing the 'blank' template
  2. cd into TestApp
  3. expo install expo-dev-client
  4. expo prebuild
  5. yarn ios

Stacktrace (if a crash is involved)

No response

jason0x43 wrote this answer on 2022-01-25

The issue only occurs when the app is loaded via a URL. If the app icon is tapped, the dev client launcher will appear, and tapping the URL of a running expo dev server will launch the app normally. If the app is launched via a URL (via yarn ios, by pressing i in the dev server window, or by entering the dev server URL in Safari in the simulator), the app will come up with a black screen and hang.

lukmccall wrote this answer on 2022-01-25
13

Hi @jason0x43, I'm able to reproduce described behavior and I'll try to fix that issue this week. Thanks for your report.

kennethlynne wrote this answer on 2022-02-02

We get the black screen whenever there is a deep link involved (opening via QR code or opening terminal shortcut). Opening via the recent server listing works. As a side note the OTA updates is also broken (app just crashes after update and reverts to the included bundle), but that might not be related (issue with expo-updates?).

I'm not on M1 just yet btw (I see the issue was confirmed on M1)

jason0x43 wrote this answer on 2022-02-02

I'm using OTA updates and haven't run into any issues (yet).

kennethlynne wrote this answer on 2022-02-02

Looks like the tests rely on ".only" now. I'd start looking there

cvburgess wrote this answer on 2022-02-02

Our team is also experiencing this issue, blocking our upgrade from 43 to 44 - please let me know if there's anything I can contribute!

brentvatne wrote this answer on 2022-02-02

@cvburgess - does [email protected] resolve the issue for you? it was released yesterday

jason0x43 wrote this answer on 2022-02-02

I just tested 0.8.3, and it does appear to have resolved the issue in my case.

kennethlynne wrote this answer on 2022-02-02

I can confirm that we now are able to open links again! However, we've seen sporadic crashes immediately after boot that we did not see previously.

colemerrick wrote this answer on 2022-02-03

Hello @brentvatne. I work with @cvburgess. [email protected] resolves our issue. Thank you!

DJ-Icebear wrote this answer on 2022-02-03

Hello! We ran in to the same thing this week, and still have this issue even after upgrading to [email protected].

A workaround for us is to first open the dev-client and then use the 'recently opened' URLs,
or use the "Enter URL manually" field and be sure to copy and paste the link into that field rather than actually clicking the link.

brentvatne wrote this answer on 2022-02-03

@DJ-Icebear - just to be sure - did you rebuild the dev client app after updating expo-dev-client to 0.8.3?

DJ-Icebear wrote this answer on 2022-02-04

@DJ-Icebear - just to be sure - did you rebuild the dev client app after updating expo-dev-client to 0.8.3?

Yessir - and our Pod Install logs include Installing expo-dev-client (0.8.3).
An Android build from the same source code does not have the same problem, only on iOS.

stdavis wrote this answer on 2022-03-02

I'm having the same issue at v0.8.4 as well...

fparhat-rbi wrote this answer on 2022-03-04

We are hitting this issue on expo-dev-client 0.8.4.
Specifically, when we launch our application via a deep link like <schema>://menu the development client launches on iOS but it results in a black screen quickly after launching.

  • No issues with Android URI links
  • No issue launching the app with URI links on iOS if the app is already running
esamelson wrote this answer on 2022-03-08

Could someone experiencing this issue post the contents of their AppDelegate.m file?

dlombardi wrote this answer on 2022-03-09

#import "AppDelegate.h"
// @generated begin react-native-maps-import - expo prebuild (DO NOT MODIFY) sync-f2f83125c99c0d74b42a2612947510c4e08c423a
#if __has_include(<GoogleMaps/GoogleMaps.h>)
#import <GoogleMaps/GoogleMaps.h>
#endif
// @generated end react-native-maps-import

#if defined(EX_DEV_MENU_ENABLED)
@import EXDevMenu;
#endif

#if defined(EX_DEV_LAUNCHER_ENABLED)
#include <EXDevLauncher/EXDevLauncherController.h>
#import <EXUpdates/EXUpdatesDevLauncherController.h>
#endif

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLinkingManager.h>
#import <React/RCTConvert.h>

#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif

@implementation AppDelegate

  • (RCTBridge *)initializeReactNativeApp:(NSDictionary *)launchOptions
    {
    // @generated begin react-native-maps-init - expo prebuild (DO NOT MODIFY) sync-3c18c06497a26c537c21be564d3413f397de92eb
    #if __has_include(<GoogleMaps/GoogleMaps.h>)
    [GMSServices provideAPIKey:@"AIzaSyDJxpdySna4G31QWCsQ4Z1uY65Kz2EJ3KU"];
    #endif
    // @generated end react-native-maps-init
    RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
    RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
    rootView.backgroundColor = [UIColor whiteColor];
    UIViewController *rootViewController = [self.reactDelegate createRootViewController];
    rootViewController.view = rootView;
    self.window.rootViewController = rootViewController;
    [self.window makeKeyAndVisible];

    return bridge;
    }

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
    InitializeFlipper(application);
    #endif

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    #if defined(EX_DEV_LAUNCHER_ENABLED)
    EXDevLauncherController *controller = [EXDevLauncherController sharedInstance];
    controller.updatesInterface = [EXUpdatesDevLauncherController sharedInstance];
    [controller startWithWindow:self.window delegate:(id)self launchOptions:launchOptions];
    #else
    [self initializeReactNativeApp:launchOptions];
    #endif

    [super application:application didFinishLaunchingWithOptions:launchOptions];

    return YES;
    }

  • (NSArray<id> *)extraModulesForBridge:(RCTBridge *)bridge
    {
    // If you'd like to export some custom RCTBridgeModules, add them here!
    return @[];
    }

  • (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
    #ifdef DEBUG
    #if defined(EX_DEV_LAUNCHER_ENABLED)
    return [[EXDevLauncherController sharedInstance] sourceUrl];
    #else
    return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
    #endif
    #else
    return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
    #endif
    }

// Linking API

  • (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    #if defined(EX_DEV_LAUNCHER_ENABLED)
    if ([EXDevLauncherController.sharedInstance onDeepLink:url options:options]) {
    return true;
    }
    #endif
    return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
    }

// Universal Links

  • (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id> * _Nullable))restorationHandler {
    BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
    return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
    }

@EnD

#if defined(EX_DEV_LAUNCHER_ENABLED)
@implementation AppDelegate (EXDevLauncherControllerDelegate)

  • (void)devLauncherController:(EXDevLauncherController *)developmentClientController
    didStartWithSuccess:(BOOL)success
    {
    developmentClientController.appBridge = [self initializeReactNativeApp:[EXDevLauncherController.sharedInstance getLaunchOptions]];
    }

@EnD
#endif

tiagotwistag wrote this answer on 2022-05-16

Hey, any updates on this? I'm using 0.8.5 on 44.0.6 and hitting the same issues

esamelson wrote this answer on 2022-05-18

Hi @tiagotwistag and everyone else still following - we believe this issue has been resolved in 0.9.x (which does require an upgrade to SDK 45), so I'd recommend upgrading when you have a chance.

More Details About Repo
Owner Name expo
Repo Name expo
Full Name expo/expo
Language C++
Created Date 2016-08-15
Updated Date 2022-09-28
Star Count 17590
Watcher Count 248
Fork Count 3541
Issue Count 494

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Implement consistency across all modes: write all parameters/settings to text files AND automatically save all generated images in ALL MODES (including scripts) 0 2022-09-17 2022-09-27
History routing not compatible with static hosting like GitHub Pages (404 on refresh) 2 2022-06-20 2022-09-27
Cross-Origin Request Blocked: Unable to fetch from server in project. 0 2022-04-16 2022-05-21
[feat]: Remove Snek from UI Dash 0 2022-08-29 2022-09-23
Plugin not working keeps getting nullpointers 2 2021-01-04 2022-09-02
Bm280 Request failed with error: 400 Details:["sensor could not be selected." 7 2022-07-13 2022-09-15
Can someone put in the README how to change the font colors (or a pointer thereto)? 2 2021-04-01 2022-08-03
Update deno.land/std/node version 0 2021-12-17 2022-07-24
> Dear @yuGithuuub, 1 2020-11-11 2022-01-08
RUSTSEC-2018-0015: term is looking for a new maintainer 3 2021-06-10 2022-08-27
@pinia/nuxt: getActivePinia was called with no active Pinia 0 2021-11-17 2022-09-24
Disable gmail watching 0 2021-12-15 2022-07-24
Retrieve configuration from GCP Secrets 0 2021-12-15 2022-08-09
Read all emails from last historyId after recieving Pub/Sub message 0 2021-12-15 2021-12-25
Renew Gmail token with scheduled job 1 2021-12-15 2021-12-25
oauth module is not tested 0 2021-09-17 2021-12-25
create license file 0 2021-06-30 2021-12-25
GCP Quotas: insure 'Free tiers' quotas are respected 0 2021-06-30 2022-07-15
Support for Phoenix 1.6 & HEEx 14 2021-09-01 2022-05-24
Rank defficient matrix with EIGEN_SPARSE_QR algorithm for covariance computation 2 2022-03-21 2022-09-27
Implement animated tile map tiles. 1 2021-01-02 2022-09-22
Error in substitution rule when encountering term + URL + linebreak + URL 0 2022-08-17 2022-09-18
Trying to create a new page while in graph view results in applying a filter to the graph 0 2022-01-22 2022-09-04
cockroachdb container not working with jdbc 6 2022-02-17 2022-09-25
Extra application pages are not properly displayed. 1 2021-10-01 2022-08-25
Add semantic versioning to the project release flow 3 2021-11-02 2022-09-14
Separate hotkeys instead of "Toggle Window" 0 2022-09-09 2022-09-21
openwisp_users.models.User doesn't declare an explicit app_label 3 2021-11-09 2022-08-29
Facing issue while converting Darknet YOLO model to keras model 1 2020-05-01 2022-09-01
CombinerGenerator does not transfer sideset names from the combined mesh, only IDs 0 2022-04-20 2022-07-08
Please use SEMVER on this package! 7 2022-04-27 2022-09-14
10 - Kafka副本机制详解 0 2021-08-10 2022-01-16
Issue while recording my lecture on Microsoft teams 2 2020-10-01 2022-09-26
您好,看了后记后的提问 1 2021-01-19 2022-01-04
Error in ANTLR representation of The try statement 6 2022-05-27 2022-09-28
Allow for default infoview closed. 1 2021-06-27 2022-09-23
Song restarts phone when wakes from sleep 3 2021-07-14 2022-08-07
Configuration Reference gives 404 1 2021-04-13 2022-09-28
[Event Request] Add Event OnBeforeCheckStatus in Table 5092 Opportunity 1 2022-01-04 2022-09-27
[Bug] FirebaseAuth Offline Issue 2 2021-11-18 2022-07-31
Scheduled workflow failed 1 2022-04-07 2022-09-27
Add ZeroTensor fastpath for torch.bmm 0 2022-02-04 2022-09-01
(servicecatalog): Service Catalog does not support assets out of the box! 5 2022-05-16 2022-05-16
Uncaught Exception [BUG] 4 2022-05-16 2022-09-15
Job workers don't stop in reusable Zeebe environment 0 2021-07-09 2022-09-14
Improve test run output 1 2020-10-21 2022-09-02
unable to play content 11 2021-09-25 2022-09-27
Got "pngquant failed to build" error while npm install under vendor/laravel/nova 7 2022-01-05 2022-08-07
[Guided onboarding] [Security] Implement Rules tour 1 2022-08-11 2022-08-25
Error with Spring boot 2.7 and SQL Sequence on H2 with DATABASE_TO_UPPER=false 1 2022-09-16 2022-09-19