Skip to content

Commit

Permalink
fix(apple): fix crash on startup on 0.75 + New Arch (#2127)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 authored Jul 17, 2024
1 parent 6c8451f commit 6debf33
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ios/ReactTestApp/ReactInstance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,30 @@ final class ReactInstance: NSObject, RNXHostConfig {
}

var remoteBundleURL: URL? {
didSet {
get { remoteBundleURLInternal }
set {
remoteBundleURLInternal = newValue
initReact(bundleRoot: bundleRoot, onDidInitialize: { /* noop */ })
}
}

private(set) var host: ReactNativeHost?
private var bundleRoot: String?

override init() {
// This needs to be lazy because `ReactInstance.jsBundleURL()` will call
// `InspectorFlags::getFuseboxEnabled()` ->
// `ReactNativeFeatureFlags::fuseboxEnabledRelease()` before any overrides
// are set. Setting overrides after this will trigger asserts and crash the
// app on startup.
private lazy var remoteBundleURLInternal: URL? = {
#if DEBUG
remoteBundleURL = ReactInstance.jsBundleURL()
ReactInstance.jsBundleURL()
#else
nil
#endif
}()

override init() {
super.init()

// Bridged
Expand Down

0 comments on commit 6debf33

Please sign in to comment.