Error: received error: [57] Socket is not connected - iOS 10

16,804

Solution 1

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.

Solution 2

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

Share:
16,804

Related videos on Youtube

Jono Tho'ra
Author by

Jono Tho'ra

Interactive Mobile and Web Developer

Updated on September 16, 2022

Comments

  • Jono Tho'ra
    Jono Tho'ra over 1 year

    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?

    • matt
      matt over 7 years
      If you don't know what point in your code is triggering the error message, you might try stepping through it with breakpoints.
    • sinewave440hz
      sinewave440hz over 7 years
      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.
    • James C
      James C over 7 years
      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.
    • Vladimir Grigorov
      Vladimir Grigorov over 7 years
      Same with me, I'm using Firebase in my app
    • npenkov
      npenkov over 7 years
      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.
    • Punita
      Punita over 7 years
      Same error happens to me also with iOS 10.0.1 and Xcode 8.0. @JThora, have you find any solutions?
    • Punita
      Punita over 7 years
      Hello JThora, Have you get any solution? I am facing the save error while sending XML request using NSURLConnection class
    • 0xNSHuman
      0xNSHuman over 7 years
      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.
  • M. Ryan
    M. Ryan almost 6 years
    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.