skip to Main Content

at the beginning I would say everything was good until Monday one week ago. At the Friday everything works, and at Monday not.. Nothing changed.

My problem occurs only in the real apple devices (I’ve tested two of them).
When I’m building app via VSC (I need to manually click on the app at the device screen – I mean the application never opens by itself, only via VSC) error says:
Picture of Device Error

When I trying via xCode I’ve extra piece of information:

Task <5317CDF5-7FFB-4037-860C-287CC6D11B37>.<1> finished with error [-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not
connect to the server." UserInfo={_kCFStreamErrorCodeKey=61,
NSUnderlyingError=0x302fcd500 {Error Domain=kCFErrorDomainCFNetwork
Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is
satisfied), interface: lo0, _kCFStreamErrorCodeKey=61,
_kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <5317CDF5-7FFB-4037-860C-287CC6D11B37>.<1>,
_NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <5317CDF5-7FFB-4037-860C-287CC6D11B37>.<1>"
), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=http://localhost:8081/status,
NSErrorFailingURLKey=http://localhost:8081/status,
_kCFStreamErrorDomainKey=1}

After trying refresh app in the metro I’ve:

No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.

My versions:

react-native: "0.75.4",
Device: iOS 18.1.1,
Mac: Air M2; macOS 15.1.1

So far I’ve done:

  • Mac and device are on the same WiFi Network
  • They are connected also via usb cable
  • Tried to write manually ip adress from mac in the dev menu (when does no bundle url stop appearing)
  • at localhost at the phone I’ve: React Native packager is running. and on the mac side at http://localhost:8081/status I’ve: packager-status:running
  • Tried deleting DeliveryData, Pods, node_modules, package content from org.swift.swiftpm, build folder
  • Killing metro servers
  • restarting both devices
  • Trying to hotspot internet via different device and connecting mac and iOS device to them.
  • My Info.plist has:
<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <false/>
        <key>NSAllowsLocalNetworking</key>
        <true/>
    </dict>
  • Tried manually create the main.jsbundle file, no bundle url error disappear but hot refresh still wasn’t working, and I don’t remember why, but this not passed the exam.
  • Tried set the Google DNS 8.8.8.8 and 8.8.4.4 at the mac and iphone.
  • Don’t remember for sure but I updated Apple licences
  • sudo xcodebuild -license
  • Disabled Private Wi-Fi Address on both devices (mac,iphone)

And others that I cannot recall now. I’m searching for new solutions and I hope you can help me with this, thank you in advance.

2

Answers


  1. Chosen as BEST ANSWER

    TLDR:

    • Uncheck the For install builds only in target: {Your AppName} -> Build Phases -> Bundle React Native code and images.

    Okay guys, today I don't know if I found solution or whatever but: First I've unchecked For install builds only and Based on dependency analysis, next I've run my project and it finally works! I don't know why but If I checked it again, its still works good as before. I also checked how it is in brand new project and the For install build only its unchecked so I unchecked it too. (I've also check the commits and yes, I changed the value for mistake :v OMG)

    enter image description here


  2. Today again stops working, above solution doesn’t work any more.. Just love the environment of RN CLI…

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search