facebook / react-native

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

"__nw_connection_get_connected_socket_block_invoke Connection has no connected handler" in logs #10027

Closed jaggerwang closed 10 months ago

jaggerwang commented 8 years ago

Workaround

Edit by @hramos, maintainer:

Several solutions have been presented in this thread:

OS_ACTIVITY_MODE

@HADB proposed:

  1. Open Xcode.
  2. Open Product menu.
  3. Select Edit Scheme...
  4. Add the following under Environment Variables: Name: OS_ACTIVITY_MODE Value: disable
  5. Run your app again

Using react-devtools

Alternatively, ensure react-devtools is installed on your system.

Resolution

This is a known issue in the iOS Simulator. The issue will remain open to increase visibility. We are limited comments on this thread to core contributors. Pull requests with proposed fixes are welcome.

Original Issue

ENV

RN 0.32 iOS 10, iPhone 6 Plus

Problem

The console of Xcode continue print "__nw_connection_get_connected_socket_block_invoke 6 Connection has no connected handler".

Screen

image

aprct commented 8 years ago

+1

matthiasdilger commented 8 years ago

+1 not possible to fetch() remote json data on ios10 w/ RN 0.33

chujian commented 8 years ago

+1 ios 10.0.1 RN 0.33

cocbin commented 8 years ago

+1

imoreapps commented 8 years ago

+1

mceoin commented 8 years ago

+1

HADB commented 8 years ago

+1

marcpechaitis commented 8 years ago

Also happening with iOS 10.0.1 and RN 0.30

edit: I followed the recommendations here and am no longer getting the messages

aprct commented 8 years ago

Still an issue with: RN 0.34 XCode 8.0 iOS 10.0 simulator

It's working with the iOS 9.2 simulator, however.

DrBeak1 commented 8 years ago

@marcpechaitis I'm not able to get to the library file for RCTWebSocket how did you find it? RTCWebSocket doesn't show up in my targets.

marcpechaitis commented 8 years ago

@DrBeak1

screen shot 2016-09-23 at 1 24 20 pm

DrBeak1 commented 8 years ago

Thanks for responding @marcpechaitis . Ah. OK - I think the issue is that react-native is integrated into my project, which was originally ONLY a native obj-c project. React was integrated in afterwards (using instructions here). So my project doesn't have a Libraries folder that contains each of the individual xcodeproj files. The files are in the project, just not contained within a target:

screen shot 2016-09-23 at 1 08 19 pm
pt-br commented 8 years ago

+1

DrBeak1 commented 8 years ago

I was able to track down the RCTWebSocket.xcodeproj, open it, and alter the warning flags but the annoying __nw_connection_get_connected_socket_block_invoke log persists. The method mentioned by @marcpechaitis (ref from here) to fix this does not work for pre-existing apps that have integrated react-native (vs apps that started as react-native apps). I can't even find where this log call is being fired off (not in obj-c files, not in any node-modules). still investigating.

edit: this is only an issue when building against main.jsbundle ... if I build against localhost (debug) these logs go away. I suspect that because I'm building in debug mode RN assumes I want to connect to the debug localhost server; which in this case is not true. My RN development is finished, and that portion of the app is running using the main.jsbundle file I created.

matthiasdilger commented 8 years ago

The build error that @marcpechaitis mentioned was fixed in RN 0.33 This error is a runtime error. Interestingly, it works for me in ios 10 simulator but not on the actual device.

DrBeak1 commented 8 years ago

@matthiasdilger oops, thought @marcpechaitis was referencing the OP.

screen shot 2016-09-23 at 5 01 17 pm
HADB commented 8 years ago

Hi, guys! This works for me (on simulator):

  1. Xcode menu -> Product -> Edit Scheme...
  2. Environment Variables -> Add -> Name: "OS_ACTIVITY_MODE", Value:"disable"
  3. Run your app again, done! 😄
matthiasdilger commented 8 years ago

@HADB still fails on device for me

matthiasdilger commented 8 years ago

Got it working on device and simulator now by reassigning all signing certificates and entitlements in the project.

Xcode 8.0, ios10, iphone 5s

imoreapps commented 8 years ago

Below RCTWebSocket target's compiler settings works for me. rctwebsocket xcodeproj

fud commented 8 years ago

None of these solutions work for me at all. I've added in the exceptions in my info.plist and I just can't connect to my package server from my physical phone. I don't want to turn off errors like @HADB mentioned with OS_ACTIVITY_MODE as well, this is a legitimate error.

fatonramadani commented 8 years ago

Any fix for this issue ?

aleclarson commented 8 years ago

+1

RN 0.34.0 iOS 10.0.1 iPhone 5S

In the iOS 10 simulator, I'm also getting a ton of __nw related log messages.

frnk94 commented 8 years ago

+1

RN 0.35.0-rc.0 IOS 10.1 Iphone 7 Plus

JansenLi commented 8 years ago

+1

aleclarson commented 8 years ago

This seems to be an iOS 10 issue, and not a React Native one.

https://twitter.com/xenadu02/status/776669668404629504

Using OS_ACTIVITY_MODE=disable (as HADB suggests) is the only current workaround.

frnk94 commented 8 years ago

@aleclarson I agreed with the log part but react-native still fail to fetch the bundle file on IOS 10

aleclarson commented 8 years ago

@frnk94 Are you talking about the .jsbundle? The packager is serving my development bundle just fine.

You might be using an outdated AppDelegate.m if it doesn't have this:

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
frnk94 commented 8 years ago

@alanchenup I think its an issue with my AppDelegate.m not connecting to my actual device thanks for the reply i'l fix my code ! :). It working great in simulator

pietgk commented 8 years ago

i got it solved by xcode menu commands: product -> clean and (hold down option key) product -> 'clean build folder'

cbcye commented 8 years ago

+1

RN 0.34.0 iOS 10.0.1 iPhone 5S

working in iOS 10 simulator but not work in real iphone 5S

dmur commented 8 years ago

@pietgk No such luck with that solution for me.

OS_ACTIVITY_MODE=disable works but it's more of a nuclear option given that it hides all your NSLog statements when running on a device. Perhaps it's better to just live with the log pollution for now when running on device.

muudyguy commented 8 years ago

@aleclarson @frnk94 Actually, the real error we get I think is : Sending websocketFailed with no listeners registered.

I cannot reload js from server either, on the physical device that is.

bitcoinvsalts commented 8 years ago

+1

ryanscottaudio commented 8 years ago

+1

jkomyno commented 8 years ago

@marcpechaitis Thanks for sharing my article!

patrickhoehn commented 7 years ago

+1

warrenronsiek commented 7 years ago

I get this when I have both remote debugging and console debugging (via react-native log-ios). Disabling remote debugging solves the problem.

JansenLi commented 7 years ago

@warrenronsiek how to disable remote debugging?

warrenronsiek commented 7 years ago

@JansenLi If you don't know what it is, this probably isn't causing the problem. In your simulator hit command+D and a menu will pop up where you can enable or disable 'Debug JS Remotely'.

necsoft commented 7 years ago

+1

SerzN1 commented 7 years ago

+1

andrekovac commented 7 years ago

Got this error when my phone was not connected to Wifi.. 🙈

jeffaxup commented 7 years ago

The solution from HADB above worked for me, but it's missing a few steps in XCode8, which are added here for clarity:

  1. Xcode App -> Product -> Scheme -> Edit Scheme...
  2. Run -> Arguments -> Environment Variables -> Add (+) -> Name: "OS_ACTIVITY_MODE", Value:"disable" -> Close
  3. Run your app again, done! 😄 This does remove the errors while running, but I'm not sure if it solves the underlying problem.
mccord commented 7 years ago

+1

futurechallenger commented 7 years ago

not helpful, trying to figure out what's going on

j-wang commented 7 years ago

Still present on

RN 0.40.0 iOS 10.1 iPhone 6+

(Clean install with react-native init)

Disabling the logs work, or I can just filter and ignore them, but does anyone know what/if something is actually broken from this?

rickcha commented 7 years ago

+1

kayoubi commented 7 years ago

+1

pantaopt commented 7 years ago

+1