Questions tagged [nsinputstream]

NSInputStream is an Objective-C class on iOS , a subclass of NSStream that provides read-only stream functionality. NSInputStream is “toll-free bridged” with its Core Foundation counterpart, CFReadStreamRef.

150 questions
13
votes
1 answer

SWIFT ONLY -- Reading from NSInputStream

Could you please explain me how do I read properly from an NSInputStream? I couldn't understand what is UnsafePointer and what's the use of it (also for UnsafeArray). The NSInputStream read function gets an CMutablePointer which can be filled with…
johni
  • 5,342
  • 6
  • 42
  • 70
12
votes
2 answers

NSInputStream stops running, sometimes throws EXC_BAD_ACCESS

(UPDATED) this is the problem in a nutshell: in iOS I want to read a large file, do some processing on it (in this particular case encode as Base64 string() and save to a temp file on the device. I set up an NSInputStream to read from a file, then…
PeterD
  • 642
  • 1
  • 6
  • 17
12
votes
2 answers

Streaming NSXMLParser with NSInputStream

Update: When using NSXMLParser class method initWithContentsOfURL, rather than parsing as the XML feed is downloaded, it appears to try to load the entire XML file into memory, and only then initiate the parsing process. This is problematic if the…
Rob
  • 415,655
  • 72
  • 787
  • 1,044
11
votes
1 answer

Enqueueing into NSInputStream?

I would like to add three "parts" to an NSInputStream: an NSString, an output from another stream and then another NSString. The idea is the following: The first and last NSStrings represent the beginning and end of a SOAP request while the output…
PeterD
  • 642
  • 1
  • 6
  • 17
10
votes
1 answer

Failing to subclass NSInputStream from Swift (initWithData: unrecognizer selector)

I can't seem to figure out what I am doing wrong to produce the following error: 2015-02-02 12:48:17.029 InputStreams[14816:221224] -[InputStreams.CustomStream initWithData:]: unrecognized selector sent to instance 0x7fda2e1aac30 Here is my…
cnoon
  • 16,575
  • 7
  • 58
  • 66
7
votes
1 answer

Swift 2 : AVAssetReader and NSInputStream Audio Graph

I'm trying to convert an example from Bob McCune's Learning AVFoundation book and having some issues using AVAssetReader and NSInputStream. The graph should be a pure sine wave but the values seem reflected on the X-axis somehow. I've tried every…
Justin Levi Winter
  • 2,327
  • 2
  • 17
  • 30
6
votes
2 answers

How to convert NSStream (NSInputStream / NSOutputStream) to SSL after stream opened?

I have NSInputStream and NSOutputStream from this code var readStream: Unmanaged? var writeStream: Unmanaged? CFStreamCreatePairWithSocket(kCFAllocatorDefault, sslSocket!, &readStream, &writeStream) if…
Adrian
  • 273
  • 1
  • 4
  • 14
6
votes
1 answer

iOS HTTP multipart-form Streaming Request

I have to implement a file upload for my app. Files like Assets (which can be Photo or Video) should be uploaded to a web sever using a REST interface. The upload would use a form data request with custom header attributes. Problem: Holding large…
Bins Ich
  • 1,822
  • 6
  • 33
  • 47
5
votes
1 answer

-[NSInputStream read:maxLength:] throws an exception saying length is too big, but it isn't

I use an NSInputStream to read data from a file. It will crash if maxLength is greater than 49152. When it crashes -- sometimes, but not every time, it gives this message: *** Terminating app due to uncaught exception…
user523234
  • 14,323
  • 10
  • 62
  • 102
5
votes
1 answer

iOS7 comparison of constant with expression is always false

In my app that works on iOS 5 and 6 I have an if statement: NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:sourcePath]; if ([inputStream streamStatus] == NSStreamEventErrorOccurred){ [...] } On iOS 7 I get the following…
Teo
  • 3,394
  • 11
  • 43
  • 73
4
votes
2 answers

How to read data from NSInputStream explicitly in swift?

I am using a socket connect in my application. Here's my SocketConnection.swift init(host: String, port:UInt32){ self.host = host self.port = port self.status = false output = "" super.init() } …
iosLearner
  • 1,312
  • 1
  • 16
  • 30
4
votes
1 answer

RN42 Bluetooth disconnects on iOS within seconds of streaming data

I've been trying to read data from a device via Bluetooth 2.1 using an RN-42. The device pairs to an iPhone or iPad Mini, and data is streamed across briefly, but the iOS & BT module disconnect (unpair) within seconds (less than 10). The device is…
4
votes
1 answer

NSOutputStream crashing with Bad Access after write (Objective-c)

I have been trying to get a basic TCP client up and running for my iOS application but have run into a block which i cannot seem to work my head around. So far i can connect, send a message which is received on the server side but then my app…
4
votes
1 answer

Subclassing NSInputStream to upload a particular portion of data from a local filepath

I am having a 100 MB of data in a single file. This 100 mb data will be divided virtually. i.e., I need to create an NSInputStream which points to different 5MB chunks. This is possible by creating the stream with NSData. But rather I'd like to know…
Sj.
  • 1,674
  • 2
  • 15
  • 23
4
votes
3 answers

Need assistance uploading multiple large image from ios device

I successfully fetched all images url in my iphone image gallery using alasset library and stored in an array. Now i am trying to upload to server, here is my code: I tried two approaches, but both crashes after iterating around 10 images, with out…
S.J
  • 3,063
  • 3
  • 33
  • 66
1
2 3
9 10