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
0
votes
1 answer

Reading .txt File into NSInputstream returns filestream has no bytes available

I used NSInputstream to read from a file. After reading, the NSInputstream contents are empty.I used the code(For transferring a .txt file to ftp server) - (void)startSend { AppDelegate *mainDelegate = (AppDelegate *)[[UIApplication…
ARATHY
  • 349
  • 5
  • 13
  • 29
0
votes
0 answers

NSInputStream - appending data without using NSMutable data appending

I want to appending the data in NSInputStream without using NSMutable data append. Is it possible to do it? Please guide me
Finder
  • 8,259
  • 8
  • 39
  • 54
0
votes
1 answer

iOS: outputStream does not stay open

Okay so I'm implementing a NSOutput and Input Streams. When they are initialized, the streams open and connect to my TCPServer I have running on my PC, but then appear to close once outside of the initializing function or maybe the streams aren't…
justsomeguy
  • 115
  • 1
  • 11
0
votes
1 answer

IOS NSInputStream

I got a problem when using NSInputStream. I have client app which connect to a server then server will start to send message to my client app through TCP repeatedly about 1 message per second. Server is just broadcasting message to client and…
0
votes
1 answer

How do I read an NSInputStream while writing it to an NSOutputStream in iOS?

I am porting an Android app to iPhone (more like improving the iPhone app based on the Android version) and I need to split and combine large uncompressed audio files. Currently, I load all the files into memory and split them and combine them in…
rmooney
  • 6,123
  • 3
  • 29
  • 29
0
votes
2 answers

Class NSURLRequest. Method - (NSInputStream *)HTTPBodyStream always returns nil. Why?

I am trying to use NSURLRequest with NSURLConnection to establish a binary stream connection to an HTTP server to retrieve a humungous data file in small, incrementally pieces. I see the method - (NSInputStream *)HTTPBodyStream on NSURLRequest. Is…
dugla
  • 12,774
  • 26
  • 88
  • 136
0
votes
2 answers

How do you read the rendered html code of a website in Objective-C line by line?

So I have had extensive experience reading rendered html source code of a website in Java. However I have researched thoroughly regarding how to do the exact same thing in Objective-C and have been able to come up with a solution that should work,…
Jessicardo
  • 826
  • 1
  • 8
  • 12
0
votes
1 answer

NSInputStream read: maxlength: returning way more bytes than maxlength

I have an iOS app where I am using NSInputStream (based on a CFReadStreamRef) for reading from a network socket. I keep getting data from the server and I keep reading and processing it (using read:bytesBuffer maxLength:l). It works fine the first…
R.S
  • 321
  • 3
  • 15
0
votes
1 answer

How to get stream bytes and convert back to image - IOS

How to get stream bytes and convert back to image, below is my code. But the images I get is blank. Why? Something wrong of the code? I get the bytes from my NSOutputStream and convert back to NSData, then convert the NSData to…
user831098
  • 1,803
  • 6
  • 27
  • 47
0
votes
1 answer

iOS access a single instance of an object from two different classes

Is it possible to create an instance of an object in class A and access that same instance of the object from class B? I am trying to develop an app that creates a TCP Socket using NSInputStream and NSOutputStream and need more than one class to be…
Travis Elliott
  • 291
  • 2
  • 5
  • 18
0
votes
1 answer

Close NSStreams when app goes to background

I am new to objective C and ios development. I generally program Android apps with Java and always used the onPause call to close my sockets. However when I call my close socket method under applicationWillResignActive I loose communication with…
Travis Elliott
  • 291
  • 2
  • 5
  • 18
0
votes
2 answers

NSInputStream working with with local file, not with file pulled down from server

Hey guys so I'm pulling down a yaml file from a web server. My NSInputStream works great with local yaml files (using file://filename.yaml url scheme) Here's the relevant code snippet: NSInputStream * stream = [[NSInputStream alloc]…
Msencenb
  • 5,675
  • 11
  • 52
  • 84
-1
votes
1 answer

NSInputStream subclass

I implemented NSInputStream subclass like following: ClassName: SampleInputStream -(id)init{ self = [super init]; if (self) { } return self; } - (NSInteger)read:(const uint8_t *)buffer maxLength:(NSUInteger)length{ return 0; } -…
iOS
  • 811
  • 1
  • 6
  • 8
-1
votes
1 answer

Incompatible pointer type 'uint8_t *' send to 'uint8_t **' - How can it be fixed?

I get the warning Incompatable ponter type 'uint8_t *' send to 'uint8_t **' when passing value to parameter 'buffer' in below method in NSStream class - (BOOL)getBuffer:(uint8_t **)buffer length:(NSUInteger *)len; Below is the code I am using.…
-2
votes
1 answer

Can't figure out why I get a fatal error: unexpectedly found nil while unwrapping an Optional value

I keep getting this error : fatal error: unexpectedly found nil while unwrapping an Optional value and cannot figure out how to debug it! Here's my code : func readCSV() -> Array { // Creates a new array of strings var csvArray…
1 2 3
9
10