28

I just updated to Xcode 8 and iOS 10.

After creating a build, I'm running into an error which I think is contributing to some data not getting fetched.

I don't know where to go from here, but it appears to be related to http calls somehow. Either way, I don't like the looks of these errors and need to get to the bottom of things.

In the log I get:

[] nw_connection_write_close 9 Connection is not ready, sending error callback
[] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected

What do these errors mean and how might I go about finding where to look?

Are these error reports related to the depreciation of NSURLConnection as of iOS 9?

Jono Tho'ra
  • 1,476
  • 3
  • 18
  • 28
  • If you don't know what point in your code is triggering the error message, you might try stepping through it with breakpoints. – matt Sep 14 '16 at 02:11
  • 2
    Updated to Xcode 8 and iOS 10 too. I'm also seeing precisely these errors, and am also experiencing some http issues. Specifically, a completion url configured in my app is no longer being called (works on iOS 9). If you make any headway, please update! Looking too, but this is 3rd party code and I'm not making much progress... Stepping through didn't reveal much either. This happens after the view is laid out, that's all I've identified so far. – sinewave440hz Sep 18 '16 at 11:49
  • 2
    The same error happened to me while I was having some issues using NSURLSession to do an uploadTask but it went away when I was successfully sending data. I never used NSURLConnection. – James C Sep 20 '16 at 22:24
  • 2
    Same with me, I'm using Firebase in my app – Vladimir Grigorov Sep 21 '16 at 12:01
  • 1
    Same happens to me too with iOS10.0.1. It seems that when the socket connection drops, the corresponding error delegate methods: - `(void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(nullable NSError *)error;` or with old NSURLConnection: `- (void) connection:(NSURLConnection*) connection didFailWithError:(NSError*) error`. I have tested this with both old and new NSURLSessionStreamTask. The issue in my case was raised when reading from InputStream - it returns 0 bytes. – npenkov Sep 27 '16 at 13:52
  • 1
    Same error happens to me also with iOS 10.0.1 and Xcode 8.0. @JThora, have you find any solutions? – Punita Sep 29 '16 at 11:31
  • 1
    Hello JThora, Have you get any solution? I am facing the save error while sending XML request using NSURLConnection class – Punita Sep 30 '16 at 12:35
  • 5
    Hey guys, JThora and @Punita, did you have any luck with it? I'm experiencing this when app goes background, socket drops connection. Even if background mode is active for the app. – 0xNSHuman Oct 07 '16 at 14:45
  • Hey @0xNSHuman, did you solve the problem? I have the exact problem – Binaya Thapa Magar Oct 14 '22 at 11:51

3 Answers3

14

We got the same error. The problem was that we used background without having the key in the info.plist file (see image below).

enter image description here

After we fixed this, the error message disappeared. Instead we got a lot of log messages, which you can turn off (see Hide strange unwanted Xcode 8 logs).

I hope this helps.

Community
  • 1
  • 1
mbachm
  • 444
  • 5
  • 8
  • 4
    There's definitely something to this error message that doesn't involve background modes. I get it in foreground as well. However, I will note that despite seeing this error message, I don't detect any adverse behavior. I'm wondering if this is just log noise from Xcode? Wouldn't be the first time. – M. Ryan Jun 05 '18 at 21:19
3

I clean the project and the problem solve for me command+shift+k

Jain
  • 39
  • 1
1

My best guess is that these error messages have to do with the server you are trying to reach, as opposed to your usage of NSURLConnection

I began experiencing these messages in iOS 11 (and the corresponding Xcode versions) when testing my program locally.

I noticed that I only saw these errors when testing against my local Django server. When pointing the app a normal, appropriately configured webserver, I would not see them.

Some related reading suggests (but not definitively) that this message might have to do with contacting servers which do not have SSL configured (properly, or at all). This would correlate with my experiences.

Anecdotally, I see these errors constantly when testing on my local server, however, I have yet to notice a single instance where this has resulted in adverse behavior, such as a failed request, and in fact, my response handlers don't even think that a proper HTTP error has taken place.

My assessment of all this information is that this is typical Xcode noise resulting from the underlying network APIs fighting with poorly configured webserver stacks.

M. Ryan
  • 6,973
  • 11
  • 52
  • 76