Skip to content

Commit 1c04c47

Browse files
Merge pull request #50 from mendix/MOO-2374-fix-ios-ota-loop-main
[MOO-2374] - Fix iOS OTA loop
2 parents 47789b9 + fa201c7 commit 1c04c47

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- We fixed an issue that could cause iOS apps to restart repeatedly after an OTA update.
11+
1012
## [v0.5.0] - 2026-05-15
1113

1214
- We updated to React Native v0.84.1 and replaced deprecated APIs with modern equivalents.

ios/Modules/ReactNative.swift

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@ open class ReactNative: NSObject, RCTReloadListener {
8181
// MARK: - Reload Methods
8282
public func reload() {
8383
guard let mendixApp = mendixApp else { return }
84-
85-
let otaBundleUrl = OtaJSBundleFileProvider.getBundleUrl()
86-
if !mendixApp.isDeveloperApp, let otaBundleUrl = otaBundleUrl {
87-
RCTReloadCommandSetBundleURL(otaBundleUrl)
88-
}
89-
84+
85+
// Note: under the New Architecture the bundle URL is resolved fresh in bundleURL(),
86+
// which RCTHost re-invokes on reload. RCTReloadCommandSetBundleURL is a legacy-bridge
87+
// mechanism that the bridgeless host ignores, so it is intentionally not used here.
88+
9089
if mendixApp.isDeveloperApp {
9190
let runtimeInfoUrl = AppUrl.forRuntimeInfo(mendixApp.runtimeUrl.absoluteString)
9291
RuntimeInfoProvider.getRuntimeInfo(runtimeInfoUrl) { [weak self] response in
@@ -153,7 +152,19 @@ open class ReactNative: NSObject, RCTReloadListener {
153152
}
154153

155154
public func bundleURL() -> URL? {
156-
return bundleUrl
155+
// New Architecture (Bridgeless): RCTHost re-invokes this provider block on every
156+
// reload (via RCTRootViewFactory's bundleURLBlock) instead of consulting the URL set
157+
// by RCTReloadCommandSetBundleURL. Resolve the OTA bundle fresh here so a freshly
158+
// deployed OTA bundle is picked up after reload. Without this, every reload re-loads
159+
// the bundle captured at host-creation time and the app loops:
160+
// download -> deploy -> reload -> same bundle.
161+
//
162+
// For the developer app (and remote debugging) the cached packager URL must be used,
163+
// so only the production path re-resolves through BundleHelper.
164+
if mendixApp?.isDeveloperApp == true {
165+
return bundleUrl
166+
}
167+
return BundleHelper.getJSBundleFile()
157168
}
158169
}
159170

0 commit comments

Comments
 (0)