2 Replies
      Latest reply on Jul 13, 2019 6:55 PM by alexChudi
      alexChudi Level 1 Level 1 (0 points)

        I recently got the following message in XCode while I was debugging:

        An error occurred
        NSStreamEvent(rawValue: 8)


        The code from which this originated was :

        func stream(_ aStream: Stream, handle eventCode: Stream.Event) {
                switch eventCode {
                    case Stream.Event.hasBytesAvailable:
                        readBytes(stream: aStream as! InputStream)
                        break
                    
                    case Stream.Event.endEncountered:
                        print("End of Stream")
                        break
                    
                    case Stream.Event.errorOccurred:
                        print("An error occurred")
                        print(eventCode)
                        break
                    
                    case Stream.Event.hasSpaceAvailable:
                        print("Space Available")
                        break
                    
                    default:
                        print("Stream Event : \(eventCode)")
                        break
                }
        ...
        }
        

         

        What can I deduce from this error code? Apple does not have '8' as a possible stream status constant.
        See here for stream status constants : https://developer.apple.com/documentation/foundation/nsstream/stream_status_constants?language=objc