iOS prod app crashed on launch only on some devices (passed App Store review)

My app has been approved by Apple and is available on the App Store. However, it crashes on launch on some devices, while most of the other devices work fine.

We’ve tried many things but still can’t figure out the problem and also can’t reproduce it. If you have any insights or suggestions on how we can proceed, please let us know, thanks!

Here are some details that may help in identifying the issue:

  1. App crashes on launch on some devices, but most devices work without issues.
  2. Issue reported in Singapore and Thailand, but not specific to the region as some other apps in those countries work well.
  3. One user experiencing the issue was on the same WiFi network as another user without the issue, suggesting that it was not a network-related problem.
  4. Sentry has been installed to catch errors but didn’t detect any error when the app crashed on launch. This indicates that the issue may be happening before Sentry launches.
  5. Devices crashing are iPhone 13 (iOS 16.3, iOS 16.4) and iPhone 13 Pro (iOS 16.2). Tests on AWS Device Farm with iPhone 13 (iOS 16.0.2) and iPhone 13 Pro (iOS 15.2) (the only iOS versions supported) passed, suggesting that it’s not a device-specific issue.

Package information

  • React Native 0.70.5
  • Expo SDK 47
  • EAS CLI 3.10.0

Update: Got an error message from one of the user

 ERROR  RangeError: Invalid Date
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

iOS crash log with the crashing thread

Incident Identifier: 8B7F4A8D-E32F-4BAE-AAFB-D0F780929694
CrashReporter Key:   ee432b7f594204dc754625e19ef274943345c9b1
Hardware Model:      iPhone14,2
Process:             MyApp [834]
Path:                /private/var/containers/Bundle/Application/87D1B99A-5144-426A-BB71-301F43FD507E/MyApp.app/MyApp
Identifier:          com.company.myapp
Version:             1.0.0 (166)
AppStoreTools:       14C17
AppVariant:          1:iPhone14,2:15
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.company.myapp [854]

Date/Time:           2023-04-16 10:54:07.0894 +0800
Launch Time:         2023-04-16 10:54:06.4107 +0800
OS Version:          iPhone OS 16.3 (20D47)
Release Type:        User
Baseband Version:    2.40.01
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  4

Application Specific Information:
abort() called

Last Exception Backtrace:
0   CoreFoundation                	       0x1ccd0ce38 __exceptionPreprocess + 164
1   libobjc.A.dylib               	       0x1c5e9b8d8 objc_exception_throw + 60
2   MyApp                        	       0x10463e9e4 0x1045a8000 + 616932
3   MyApp                        	       0x10464ffa8 0x1045a8000 + 688040
4   MyApp                        	       0x10464f7f0 0x1045a8000 + 686064
5   libdispatch.dylib             	       0x1d4323460 _dispatch_call_block_and_release + 32
6   libdispatch.dylib             	       0x1d4324f88 _dispatch_client_callout + 20
7   libdispatch.dylib             	       0x1d432c640 _dispatch_lane_serial_drain + 672
8   libdispatch.dylib             	       0x1d432d18c _dispatch_lane_invoke + 384
9   libdispatch.dylib             	       0x1d4337e10 _dispatch_workloop_worker_thread + 652
10  libsystem_pthread.dylib       	       0x21af84df8 _pthread_wqthread + 288
11  libsystem_pthread.dylib       	       0x21af84b98 start_wqthread + 8

Thread 4 name:   Dispatch queue: expo.controller.errorRecoveryQueue
Thread 4 Crashed:
0   libsystem_kernel.dylib        	       0x20a827674 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x21af8b1ac pthread_kill + 268
2   libsystem_c.dylib             	       0x1d4388c8c abort + 180
3   libc++abi.dylib               	       0x21aecab8c abort_message + 132
4   libc++abi.dylib               	       0x21aebaa80 demangling_terminate_handler() + 336
5   libobjc.A.dylib               	       0x1c5ea1d3c _objc_terminate() + 144
6   libc++abi.dylib               	       0x21aec9f28 std::__terminate(void (*)()) + 20
7   libc++abi.dylib               	       0x21aec9ec4 std::terminate() + 56
8   libdispatch.dylib             	       0x1d4324f9c _dispatch_client_callout + 40
9   libdispatch.dylib             	       0x1d432c640 _dispatch_lane_serial_drain + 672
10  libdispatch.dylib             	       0x1d432d18c _dispatch_lane_invoke + 384
11  libdispatch.dylib             	       0x1d4337e10 _dispatch_workloop_worker_thread + 652
12  libsystem_pthread.dylib       	       0x21af84df8 _pthread_wqthread + 288
13  libsystem_pthread.dylib       	       0x21af84b98 start_wqthread + 8

package.json

{
  "main": "src/main.ts",
  "scripts": {
    "start": "npx expo start -c",
    "android": "npx expo start --android",
    "ios": "npx expo start --ios",
    "eject": "npx expo eject",
  },
  "engines": {
    "node": "16.x",
    "npm": ">=8.19.3 <10.0.0"
  },
  "dependencies": {
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
    "@bedrock-layout/use-forwarded-ref": "^1.6.1",
    "@config-plugins/react-native-blob-util": "^4.0.0",
    "@config-plugins/react-native-pdf": "^4.0.0",
    "@expo/config": "^7.0.2",
    "@expo/metro-config": "^0.3.22",
    "@expo/webpack-config": "^0.17.2",
    "@hookform/error-message": "^2.0.0",
    "@hookform/resolvers": "^2.8.10",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/netinfo": "9.3.5",
    "@react-native-firebase/analytics": "^16.4.6",
    "@react-native-firebase/app": "^16.4.6",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "^6.2.0",
    "@react-navigation/elements": "^1.3.1",
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/stack": "^6.3.16",
    "@reduxjs/toolkit": "^1.6.2",
    "@sentry/browser": "^7.37.2",
    "@sentry/react": "^7.37.2",
    "@sentry/react-native": "^4.9.0",
    "@sentry/tracing": "^7.37.2",
    "@svgr/webpack": "^5.5.0",
    "@tanstack/react-query": "^4.8.0",
    "@tanstack/react-query-devtools": "^4.8.0",
    "@types/i18n": "^0.13.3",
    "@types/react-native-dotenv": "^0.2.0",
    "@types/url-parse": "^1.4.8",
    "axios": "^0.24.0",
    "babel-plugin-transform-inline-environment-variables": "^0.4.3",
    "compare-versions": "^5.0.1",
    "country-telephone-data": "^0.6.3",
    "date-fns": "^2.28.0",
    "deep-equal": "^2.0.5",
    "expo": "^47.0.0",
    "expo-apple-authentication": "~5.0.1",
    "expo-application": "~5.0.1",
    "expo-auth-session": "~3.8.0",
    "expo-av": "~13.0.3",
    "expo-build-properties": "~0.4.1",
    "expo-camera": "~13.1.0",
    "expo-clipboard": "~4.0.1",
    "expo-constants": "~14.0.2",
    "expo-dev-client": "~2.0.1",
    "expo-device": "~5.0.0",
    "expo-document-picker": "~11.0.1",
    "expo-file-system": "~15.1.1",
    "expo-image-picker": "~14.0.2",
    "expo-linear-gradient": "~12.0.1",
    "expo-linking": "~3.3.1",
    "expo-localization": "~14.0.0",
    "expo-media-library": "~15.0.0",
    "expo-network": "~5.0.0",
    "expo-notifications": "~0.17.0",
    "expo-random": "~13.0.0",
    "expo-secure-store": "~12.0.0",
    "expo-splash-screen": "~0.17.5",
    "expo-status-bar": "~1.4.2",
    "expo-updates": "~0.15.6",
    "expo-web-browser": "~12.0.0",
    "fbjs": "^3.0.4",
    "i18next": "^22.4.9",
    "i18next-locize-backend": "^5.1.2",
    "intl": "^1.2.5",
    "intl-pluralrules": "^1.3.1",
    "iso-country-currency": "^0.6.0",
    "link-preview-js": "^3.0.4",
    "lodash.omit": "^4.5.0",
    "lottie-react-native": "5.1.4",
    "mime": "^3.0.0",
    "pluralize": "^8.0.0",
    "prop-types": "^15.8.1",
    "react": "18.1.0",
    "react-device-detect": "^2.2.2",
    "react-dom": "18.1.0",
    "react-dropzone": "^14.2.3",
    "react-freeze": "^1.0.0",
    "react-hook-form": "^7.41.0",
    "react-i18next": "^12.1.5",
    "react-native": "0.70.5",
    "react-native-blob-util": "^0.17.0",
    "react-native-circular-progress": "^1.3.7",
    "react-native-dialog": "^9.2.1",
    "react-native-dotenv": "^3.3.1",
    "react-native-draggable-flatlist": "^3.1.2",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "6.0.1",
    "react-native-parsed-text": "^0.0.22",
    "react-native-pdf": "^6.6.2",
    "react-native-purchases": "^5.0.2",
    "react-native-reanimated": "~2.12.0",
    "react-native-reanimated-carousel": "^3.1.5",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-smooth-picker": "^1.1.5",
    "react-native-svg": "13.4.0",
    "react-native-svg-transformer": "^1.0.0",
    "react-native-swiper-flatlist": "^3.0.16",
    "react-native-toast-message": "^2.1.5",
    "react-native-vector-icons": "^9.1.0",
    "react-native-web": "~0.18.9",
    "react-native-web-lottie": "^1.4.4",
    "react-native-webview": "11.23.1",
    "react-redux": "^7.2.6",
    "sentry-expo": "~6.0.0",
    "socket.io-client": "^4.4.1",
    "ts-essentials": "^9.3.0",
    "type-fest": "^3.1.0",
    "url-parse": "^1.5.10",
    "uuid": "^9.0.0",
    "validator": "^13.7.0",
    "xregexp": "^5.1.1",
    "zod": "^3.17.3"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@babel/eslint-parser": "^7.17.0",
    "@react-navigation/devtools": "^6.0.5",
    "@types/country-telephone-data": "^0.6.1",
    "@types/deep-equal": "^1.0.1",
    "@types/lodash.omit": "^4.5.7",
    "@types/mime": "^3.0.1",
    "@types/pluralize": "^0.0.29",
    "@types/react": "~18.0.24",
    "@types/react-dom": "^18.0.9",
    "@types/react-native": "~0.70.6",
    "@types/react-native-snap-carousel": "^3.8.5",
    "@types/react-native-vector-icons": "^6.4.10",
    "@types/uuid": "^8.3.4",
    "@types/validator": "^13.7.1",
    "@typescript-eslint/eslint-plugin": "^5.12.1",
    "@typescript-eslint/parser": "^5.12.1",
    "axios-mock-adapter": "^1.20.0",
    "babel-plugin-module-resolver": "^4.1.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "deprecated-react-native-prop-types": "^2.3.0",
    "eslint": "^8.9.0",
    "eslint-config-prettier": "^8.4.0",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.3.0",
    "eslint-plugin-react-native": "^4.0.0",
    "locize-lastused": "^3.1.0",
    "prettier": "^2.5.1",
    "typescript": "^4.6.3"
  },
  "private": true
}

After several hours of debugging, I found out that it was because we were passing a non-ISO date string to the Javascript new Date(). It works for some of the devices (Javascript runtime) but didn’t work for all of them. And we make this call at a global level so it’s causing the entire ReactNative app to crash.

new Date("2023-01-01") // Invalid for SOME devices (Javascript runtime)

new Date("2023-01-01T00:00:00.000Z") // ISO date string valid for all devices

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.