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
1
vote
1 answer

How to search an Image file

Is there anyway to check whether a particular image file exists in my iPhone. Lets say my image name is IMG_123.JPG. I want to search this image and if it exists I want to create a NSInputStream object using that File. If the image is not in…
Irrd
  • 325
  • 1
  • 6
  • 18
1
vote
1 answer

How to reliably retrieve NSData objects from NSInputStream in XCode

So my application works along these lines: An iPod continuously sends NSDictionaries that contain: an image encoded in JPEG and some image properties as NSStrings. The NSDictionary is encoded using NSPropertyListSerialization with the format…
blakemacnair
  • 123
  • 2
  • 9
1
vote
0 answers

NSInputStream can't get any event

I am new to Objective-C. I tried to create a client to talk with server. After stream setup, I have seen event (NSStreamEventOpenCompleted & NSStreamEventHasSpaceAvailable) for NSOutputStream, but nothing for NSInputStream. It can send data to…
max
  • 11
  • 2
1
vote
2 answers

NSURLSession request body passed by slow NSInputStream (bandwidth management)

Hi based on this answer I wrote subclass of NSInputStream and it works pretty well. Now It turned out that I have scenario where I'm feeding to server large amount of data and to prevent starvation of other services I need control speed of feeding…
Marek R
  • 32,568
  • 6
  • 55
  • 140
1
vote
0 answers

Uploading a file via NSInputStream along with parameters? - Objective C

I have a need to upload a file to our server. However the server will process the file and fire it into a database. I am looking at NSInputStream which appears to work fine, however, I also need additional parameters like user token and file…
Tony Law
  • 293
  • 2
  • 13
1
vote
1 answer

Best way to send large files via TCP in Cocoa

I'm devising a protocol to be sent via TCP packets that can sometimes send large (video) files between iOS and OSX devices. I've got three questions: 1) What is the maximum size for each TCP packet for good performance? ie: Is it better to get…
1
vote
1 answer

Audio file is partially received in target iPhone from sender using Multipeer Connectivity(Swift 2)

I have opened an Output Stream from the sender iPhone and also implemented an Input (receiving ) Stream in the receiving iPhone. I am able to connect both the devices over the same Wi-Fi network using Multipeer Connectivity and send the data (I…
1
vote
0 answers

After 10 minutes network idle NSInputStream for network socket stops reading until next write on the NSOutputStream for that socket

After 10 minutes of network inactivity network events are no longer delivered to the NSInputStream in my app. During this 10 minute period the app is not deactivated, backgrounded or terminated. I confirmed this when reproducing this with lldb…
John Cashew
  • 1,078
  • 2
  • 12
  • 28
1
vote
1 answer

How to send an HTTP request with multipart data containing a json string and a big file from the file system?

Context I want to send an HTTP request with multipart body data composed by two segments: A JSON string containing some metadata Some file binary data What I already know This can be done easily as described in this answer. But what happens in a…
Gabriel Huff
  • 743
  • 1
  • 6
  • 18
1
vote
3 answers

iOS how can i perform multiple NSInputStream

My app uses NSInputStream like below: inputStream.delegate = self; [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [readStream open]; and delegate: - (void)stream:(NSStream *)theStream…
Scinfu
  • 1,081
  • 13
  • 18
1
vote
2 answers

NSURLSession with upload stream - subclassing NSInputStream - com.apple.NSURLConnectionLoader exception

Basic task I have some multiplatform library which is using some C++ stream interface. I have to use this stream interface to upload data by NSURLSession. My implementation should work on OS X and iOS (currently I'm testing on OS X) What I did Task…
Marek R
  • 32,568
  • 6
  • 55
  • 140
1
vote
1 answer

NSInputStream returned nil for file stored in local documents directory

I am trying to parse the contents of a downloaded CSV File. The file is stored in a folder in Local Documents Directory. Filepath:…
tech savvy
  • 1,417
  • 4
  • 21
  • 42
1
vote
0 answers

fatal error: unexpectedly found nil while unwrapping an Optional value while receiving image data from NSStream swift

I am sending a message to NSOutputStream to get image data as a payload in http response. let bufferSize = 999999 case NSStreamEvent.HasBytesAvailable: if (inputStream == aStream) { var buffer = [UInt8](count: bufferSize,…
iosLearner
  • 1,312
  • 1
  • 16
  • 30
1
vote
2 answers

Background Upload With Stream Request Using NSUrlSession in iOS8

Previously in iOS7 when we try to upload with stream request in background we get following exception Terminating app due to uncaught exception 'NSGenericException', reason: 'Upload tasks in background sessions must be from a file' But in iOS8 there…
1
vote
0 answers

NSStream delegate method stream:handleEvent: crashing application with EXC_BAD_ACCESS code=1

I am using NSInputStream to upload media file to server in following way. uploadInputStream = [[NSInputStream alloc] initWithFileAtPath:videoFilePath]; uploadInputStream.delegate = self; [uploadInputStream scheduleInRunLoop:[NSRunLoop…
Jay Pandya
  • 507
  • 6
  • 26