facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.48k stars 24.37k forks source link

React native IOS App Crash on Real Device #41624

Closed atifaziz1 closed 10 months ago

atifaziz1 commented 1 year ago

Description

React Native IOS app is crashing on real device but simulator is working fine. I am using Xcode 15.

Below is the error:

Could not attach to pid : “3523” Domain: IDEDebugSessionErrorDomain Code: 3 Failure Reason: attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.) User Info: { DVTErrorCreationDateKey = "2023-11-23 13:32:56 +0000"; DVTRadarComponentKey = 855031; IDERunOperationFailingWorker = DBGLLDBLauncher; RawUnderlyingErrorMessage = "attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)"; }

Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_isCoreDevice" = 1; "device_model" = "iPhone16,1"; "device_osBuild" = "17.1.1 (21B91)"; "device_platform" = "com.apple.platform.iphoneos"; "dvt_coredevice_version" = "348.1"; "dvt_mobiledevice_version" = "1643.40.14"; "launchSession_schemeCommand" = Run; "launchSession_state" = 2; "launchSession_targetArch" = arm64; "operation_duration_ms" = 36418; "operation_errorCode" = 3; "operation_errorDomain" = IDEDebugSessionErrorDomain; "operation_errorWorker" = DBGLLDBLauncher; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 3; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphoneos"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 99; "param_launcher_substyle" = 8192; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos17.0"; "sdk_osVersion" = "17.0"; "sdk_variant" = iphoneos; }

System Information

macOS Version 14.1.1 (Build 23B81) Xcode 15.0.1 (22266) (Build 15A507) Timestamp: 2023-11-23T16:32:56+03:00

React Native Version

0.71.8

Output of npx react-native info

System: OS: macOS 14.1.1 CPU: (8) arm64 Apple M1 Pro Memory: 130.11 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 6.14.4 - /opt/homebrew/bin/npm Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.1 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0 Android SDK: API Levels: 23, 25, 26, 27, 28, 29, 30, 31, 32, 33 Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0 System Images: android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-34 | Google APIs ARM 64 v8a, android-Tiramisu | Google Play ARM 64 v8a Android NDK: 24.0.8215888 IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10671973 Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild Languages: Java: 15.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.8 => 0.71.8 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

Just run the app in debug mode.

Snack, screenshot, or link to a repository

Screenshot 2023-11-23 at 4 40 52 PM
github-actions[bot] commented 1 year ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.71.14. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
github-actions[bot] commented 1 year ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
cortinico commented 1 year ago

Please provide a repro and test on React Native 0.72

atifaziz1 commented 1 year ago

@cortinico project is confidential, so I can't provide a repo link. I migrated the React Native project from 0.64 to 0.71. Project is working fine in xcode 14.3.1. I am facing issue when i run project on real device but simulator is working fine.

Please don't mind if i didn't get your point.

cortinico commented 1 year ago

We can't help at all without a reproducer sorry

atifaziz1 commented 1 year ago

Dear @cortinico

There is not steps to reproducer. App is crashing immediately and i am checking in xCode that 'attaching fail' on real device.

I can share package.json with you. May be it can help us.

Thanks for your help and support.

{ "name": "smemobileapp", "version": "3.3.00", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "postinstall": "patch-package", "lint": "eslint . --fix", "instrumentDynatrace": "node node_modules/@dynatrace/react-native-plugin/scripts/instrument.js" }, "dependencies": { "@dynatrace/react-native-plugin": "2.271.1", "@hmscore/react-native-hms-map": "6.3.1-304", "@notifee/react-native": "^7.7.1", "@react-native-community/art": "^1.2.0", "@react-native-community/async-storage": "^1.11.0", "@react-native-community/clipboard": "^1.5.1", "@react-native-community/datetimepicker": "^3.0.9", "@react-native-community/geolocation": "^2.0.2", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^5.9.4", "@react-native-community/progress-bar-android": "^1.0.3", "@react-native-community/progress-view": "^1.1.1", "@react-native-community/slider": "3.0.1", "@react-native-firebase/app": "^17.5.0", "@react-native-firebase/messaging": "^17.5.0", "@react-native-picker/picker": "^2.4.10", "@react-navigation/bottom-tabs": "^5.11.15", "@react-navigation/drawer": "^5.8.6", "@react-navigation/native": "^5.7.1", "@react-navigation/stack": "^5.14.9", "arabic-reshaper": "^1.1.0", "axios": "^0.21.0", "base-64": "^1.0.0", "crypto-js": "^3.1.8", "deprecated-react-native-prop-types": "^4.1.0", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.2", "formik": "^2.1.5", "fuse.js": "^6.6.2", "he": "^1.2.0", "i18n-js": "^3.7.1", "lodash": "^4.17.19", "lottie-ios": "^3.5.0", "lottie-react-native": "6.0.0-rc.2", "moment": "^2.27.0", "moment-hijri": "^2.1.2", "node-forge": "^0.9.1", "patch-package": "^6.5.1", "postinstall-postinstall": "^2.1.0", "prop-types": "^15.7.2", "react": "18.2.0", "react-dom": "^16.13.1", "react-native": "0.71.8", "react-native-actions-shortcuts": "^1.0.1", "react-native-android-open-settings": "^1.3.0", "react-native-animatable": "^1.3.3", "react-native-base64": "^0.2.1", "react-native-blob-util": "^0.19.1", "react-native-camera": "^4.2.1", "react-native-check-box": "^2.1.7", "react-native-circular-progress": "^1.3.7", "react-native-config": "^1.3.1", "react-native-copilot": "^2.5.1", "react-native-countdown-circle-timer": "^3.1.0", "react-native-detector": "^0.2.1", "react-native-device-info": "^5.6.2", "react-native-doc-viewer": "https://github.com/AhmedShehab312/react-native-doc-viewer.git", "react-native-document-picker": "^3.5.3", "react-native-draggable-flatlist": "^3.1.2", "react-native-elements": "^3.0.0-alpha.1", "react-native-fast-image": "^8.5.11", "react-native-fast-toast": "^3.0.1", "react-native-formik": "^1.7.8", "react-native-fs": "^2.18.0", "react-native-geolocation-service": "^5.0.0", "react-native-gesture-handler": "^1.8.0", "react-native-gradle-plugin": "^0.71.19", "react-native-html-to-pdf": "^0.12.0", "react-native-image-picker": "^4.10.3", "react-native-in-app-message": "^1.0.32", "react-native-inappbrowser-reborn": "^3.7.0", "react-native-keyboard-manager": "^6.5.4-2", "react-native-linear-gradient": "2.8.3", "react-native-localize": "^1.4.0", "react-native-map-link": "^2.7.10", "react-native-maps": "0.27.1", "react-native-modal-datetime-picker": "^11.0.0", "react-native-module-fhp-ios": "./react-native-module-fhp-ios-0.0.5.tgz", "react-native-paper": "^5.1.3", "react-native-passkit-wallet": "^0.1.4", "react-native-pdf": "^6.2.0", "react-native-permissions": "3.8.0", "react-native-popup-menu": "^0.15.12", "react-native-progress": "^5.0.0", "react-native-qrcode-scanner": "^1.5.4", "react-native-qrcode-svg": "^6.1.1", "react-native-rate": "^1.2.4", "react-native-ratings": "^7.2.0", "react-native-reanimated": "^2.16.0", "react-native-restart": "^0.0.27", "react-native-root-toast": "^3.2.1", "react-native-safe-area-context": "^3.1.1", "react-native-screens": "^3.8.0", "react-native-select-contact": "^1.6.3", "react-native-send-intent": "^1.2.2", "react-native-share": "^8.1.0", "react-native-shimmer-placeholder": "^2.0.9", "react-native-simple-accordian": "https://github.com/AhmedShehab312/react-native-simple-accordian.git", "react-native-smooth-pincode-input": "^1.0.9", "react-native-snap-carousel": "^3.9.1", "react-native-splash-screen": "^3.2.0", "react-native-status-bar-height": "^2.5.0", "react-native-svg": "^12.1.1", "react-native-svg-charts": "^5.4.0", "react-native-swipe-list-view": "^3.2.3", "react-native-swiper": "^1.6.0", "react-native-touch-id": "^4.4.1", "react-native-utils-scale": "^2.6.0", "react-native-uuid": "^2.0.1", "react-native-vector-icons": "^7.0.0", "react-native-video": "^5.2.0", "react-native-view-shot": "^3.1.2", "react-native-webview": "^11.22.7", "react-native-youtube-iframe": "^2.2.2", "react-redux": "^7.2.0", "reactotron-react-native": "^5.0.0", "reanimated-bottom-sheet": "^1.0.0-alpha.20", "redux": "^4.0.5", "redux-persist": "^6.0.0", "redux-thunk": "^2.3.0", "rn-placeholder": "^3.0.3", "rn-qr-generator": "^1.2.0", "rn-secure-storage": "^2.0.7", "shortid": "^2.2.16", "utf8": "^3.0.0", "victory-native": "^36.3.1", "yup": "^0.29.1" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/eslint-parser": "^7.23.3", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native-community/eslint-config": "^3.2.0", "@tsconfig/react-native": "^2.0.2", "@types/jest": "^29.2.1", "@types/react": "^18.0.24", "@types/react-test-renderer": "^18.0.0", "babel-eslint": "^10.1.0", "babel-jest": "^29.2.1", "babel-plugin-module-resolver": "^4.0.0", "chai": "^4.2.0", "enzyme-to-json": "^3.5.0", "eslint": "^8.53.0", "eslint-config-airbnb": "^18.2.0", "eslint-config-prettier": "^6.11.0", "eslint-config-sinon": "^4.0.0", "eslint-import-resolver-alias": "^1.1.2", "eslint-import-resolver-babel-module": "^5.1.2", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsx-a11y": "^6.3.1", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.20.3", "eslint-plugin-react-hooks": "^4.0.7", "jest": "^29.2.1", "jetifier": "^2.0.0", "metro-react-native-babel-preset": "0.73.9", "prettier": "^2.4.1", "react-router-dom": "^5.2.0", "react-test-renderer": "18.2.0", "reactotron-redux": "^3.1.3", "sinon-chai": "^3.5.0", "typescript": "4.8.4", "webpack": "^4.43.0" }, "overrides": { "react-native-qrcode-scanner": { "react-native-permissions": "3.8.0" }, "@hmscore/react-native-hms-map": { "react": "18.2.0" }, "@react-native-community/async-storage": { "react": "18.2.0" }, "enzyme-adapter-react-16": { "react": "18.2.0" }, "eslint-config-airbnb": { "eslint": "^8.19.0" }, "eslint-config-sinon": { "eslint": "^8.19.0" }, "react-native-doc-viewer": { "react": "18.2.0", "react-native": "0.71.8" }, "react-native-formik": { "formik": "^2.1.5" }, "react-native-qrcode-svg": { "react-native-svg": "^12.1.1" }, "react-native-svg-charts": { "react-native-svg": "^12.1.1" }, "react-dom": { "react": "18.2.0" }, "rn-placeholder": { "react": "18.2.0", "react-native": "0.71.8" } }, "jest": { "transform": { "^.+\.jsx?$": "babel-jest" }, "setupFilesAfterEnv": [ "/tests/setup/test-setup.js" ], "setupFiles": [ "/tests/setup/test-setup.js", "./node_modules/react-native-gesture-handler/jestSetup.js" ], "testPathIgnorePatterns": [ "/(build|docs|node_modules)/", "/tests/setup" ], "transformIgnorePatterns": [ "/node_modules(?![\/]react-native-device-info[\/]|[\/]react-native-ratings[\/]|[\/]react-native-vector-icons[\/]|[\/]react-native-status-bar-height[\/]|[\/]react-native[\/]|[\/]react-native-config[\/]|[\/]react-native-appearance[\/]|[\/]react-native-check-box[\/]|[\/]react-native-formik[\/]|[\/]react-native-modalbox[\/]|[\/]react-native-root-siblings[\/]|[\/]react-native-localize[\/]|[\/]react-native-linear-gradient[\/]|[\/]@react-native-community/async-storage'[\/]|[\/]react-native-restart'[\/])/" ], "snapshotSerializers": [ "enzyme-to-json/serializer" ], "preset": "react-native", "collectCoverage": true, "verbose": true } }

atifaziz1 commented 1 year ago

Dear @cortinico !

This is complete error:

error: attach by pid '6195' failed -- attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)

philipheinser commented 11 months ago

@atifaziz1 This is an Xcode error. Did you try to follow the error description and did you look into the console?

atifaziz1 commented 11 months ago

Dear @philipheinser!

I have checked with console, nothing is logged except . only shared error is showing.

alexghi commented 11 months ago

try and put a breakpoint debugger inside XCode right at the process where app is initialised in AppDelegate.m and see the trace from there

mirabo-vuongnt1 commented 11 months ago

I'm encountering a similar issue with my Flutter project. I've tested it on another device, and it works well on devices running lower iOS versions. However, when I try to run it on a device with iOS 17, I'm facing the same error. Any insights or suggestions on how to resolve this would be greatly appreciated! Xcode: Version 15.0.1 (15A507)

philipheinser commented 11 months ago

@atifaziz1

Dear @philipheinser!

I have checked with console, nothing is logged except . only shared error is showing.

I think you maybe checking the Xcode console but can you make sure you checking the iPhone console with the Console.app different app on the Mac. if you post the contents of the console at the time the crash happens it could help.

mirabo-vuongnt1 commented 11 months ago

@philipheinser @atifaziz1 i think this is problem

philipheinser commented 11 months ago

@mirabo-vuong-nt but that's not a bug related to react native.

atifaziz1 commented 11 months ago

Dear @philipheinser !

Thanks for your response.

I am attaching the screenshot from the Console app. I have been facing the issue for a long time.

Screenshot 2024-01-02 at 10 50 45 AM
atifaziz1 commented 10 months ago

Dear @philipheinser !

Thanks for your support I am getting error, please look into it and advice.

Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Error: invalid host, js engine: hermes', reason: 'Unhandled JS Exception: Error: invalid host, js engine: hermes, stack: validate@138651:21 configure@138374:30 createClient@138622:27 anonymous@137612:68 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 anonymous@137471:66 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 anonymous@137452:73 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 anonymous@137169:68 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 hScale@116136:43 anonymous@116176:155 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 createStyle@115889:26 anonymous@366692:82 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 anonymous@41620:62 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 anonymous@41212:62 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 anonymous@40305:58 loadModuleImplementation@150:13 guardedLoadModule@88:37 metroRequire@37:91 anonymous@659:55 loadModuleImplementation@150:13 guardedLoadModule@81:46 metroRequire@37:91 global@693343:3 ' First throw call stack: (0x18a50269c 0x18278bc80 0x1051adf08 0x104a758f8 0x104a7611c 0x18a447794 0x18a44722c 0x18a447054 0x1051ddd94 0x1051dfde4 0x1051dfa34 0x19240b6a8 0x19240d300 0x192414894 0x1924153c4 0x192420004 0x19241f878 0x1f4433964 0x1f4433a04) ERROR: KSCrashReportFixer.c (370): char DTX_kscrf_fixupCrashReport(const char ): Could not decode report: Data too long ERROR: KSCrashC.c (356): char *DTX_kscrash_readReport(int64_t): Failed to fixup report ID 76d9389e800000

nandowastaken commented 10 months ago

Hello!

I am not sure if you have solved this, but I have found this post with a verified solution: https://developer.apple.com/forums/thread/120282?page=2

Also, about your most recent error, there is a closed issue about it: https://github.com/facebook/react-native/issues/26119

atifaziz1 commented 10 months ago

Hi @nandowastaken !

Issue has been resolved. After a lot of search i found that trustkit and reactotron versions are conflicting. I updated and project is working fine now.

moniquealtero commented 9 months ago

@atifaziz1 hey, which versions did you use to fix it?