Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RN74Example – iOS OTA Update + Instabug Sample

This repo is a minimal React Native 0.74 app wired to reproduce an iOS-only issue involving a custom OTA update mechanism (react-native-ota-hot-update) and Instabug.

  • iOS only (Android intentionally skipped)
  • OTA bundles are downloaded from a public URL defined in public/update-ios.json
  • An express-less Node HTTP server is included to serve the JSON metadata locally

Prerequisites

  • Node 18+
  • Xcode (latest) with iOS Simulator or a physical device
  • CocoaPods installed (gem install cocoapods)

Install & Build (first time)

# from repo root
npm install
cd ios && pod install && cd ..

Run the app (Debug)

npx react-native run-ios

This launches the app in Debug (connects to Metro). Useful to verify UI and buttons.

Run the app (Release, no Metro)

Recommended for realistic OTA behavior.

  1. Open Xcode workspace:
open ios/RN74Example.xcworkspace
  1. In Xcode:
  • Select the RN74Example scheme
  • Product → Scheme → Edit Scheme… → Run → set Build Configuration to Release
  • Choose a simulator or a physical device
  • Product → Build (Cmd+B), then Run (Cmd+R)

The Release app embeds a production main.jsbundle and does not rely on Metro.

OTA: Local metadata server

A tiny HTTP server serves the update JSON endpoint on http://localhost:3000.

node server.js

You should see:

Server running at http://localhost:3000/
Serving update files:
- http://localhost:3000/update-android.json (ignored)
- http://localhost:3000/update-ios.json

The app fetches public/update-ios.json to determine the available update.

Buttons in the app

  • Check for Updates: fetches update-ios.json, downloads zip via downloadIosUrl, installs bundle

Create a new iOS OTA bundle (changes from App-updated.tsx)

  1. Swap App.tsx to the updated version (shows "Welcome to Contact!"):
cp App.tsx App-original.tsx && cp App-updated.tsx App.tsx
  1. Generate a production bundle + assets (standalone):
npx react-native bundle \
  --platform ios \
  --dev false \
  --entry-file index.js \
  --bundle-output ios-update-bundle.js \
  --assets-dest ios-update-assets
  1. Package in the expected OTA zip structure:
rm -rf ota-update-bundle && mkdir -p ota-update-bundle
cp ios-update-bundle.js ota-update-bundle/main.jsbundle
cp -r ios-update-assets/* ota-update-bundle/
zip -r ota-update-bundle.zip ota-update-bundle/
  1. Restore original App.tsx so the running app shows the old UI before update:
cp App-original.tsx App.tsx

Host the bundle (Google Drive or any static host)

Upload ota-update-bundle.zip somewhere public and put the direct-download URL in public/update-ios.json:

{
  "version": "2", // 2, 3, 4, ..., x
  "versionName": "1",
  "downloadIosUrl": "https://drive.google.com/uc?export=download&id=YOUR_FILE_ID"
}

Notes for Google Drive:

  • Share link looks like: https://drive.google.com/file/d/FILE_ID/view?usp=sharing
  • Convert to direct download: https://drive.google.com/uc?export=download&id=FILE_ID

Test the OTA flow

  1. Start the metadata server:
node server.js
  1. Run the app in Release via Xcode (see steps above)
  2. Tap "Check for Updates"
  3. Expected: download progress logs → app restarts → text changes to "Welcome to Contact!"

If the app doesn’t restart automatically, tap the manual restart button you added or re-open the app; the library should pick the latest bundle after restart.

Troubleshooting

  • Download fails (E_UNZIP_FAIL): ensure the zip has this structure:
    • main.jsbundle
    • assets/ (folder) and that you zipped the containing folder (not just the files individually).
  • App still shows old UI: ensure you restored App.tsx to the original before testing, and that restartAfterInstall: true is set. You can also call hotUpdate.resetApp() after updateSuccess.
  • App keeps connecting to Metro: you’re running Debug. Use Release build via Xcode as described above.
  • Instabug token: replace placeholder token in App.tsx if you want real Instabug behavior.

Project scripts

{
  "scripts": {
    "start": "react-native start",
    "ios": "react-native run-ios",
    "android": "react-native run-android",
    "pod-install": "RCT_NEW_ARCH_ENABLED=1 npx pod-install"
  }
}

What’s important for repro

  • iOS Release build (no Metro)
  • Serving public/update-ios.json locally
  • downloadIosUrl points to a zip with main.jsbundle + assets/
  • The running app was built with the old UI; the OTA bundle contains the new UI

If anything fails or you want me to wire a different host than Google Drive, ping me and I’ll adjust the URLs or script the upload.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages