NSInputStream for Streaming API iOS?


#1

Hi,

Simple question:
Can I use NSInputStream to get data from the streaming API?

If so, can someone outline what this can look like.

I have tried something like

_twitterStream = [[NSInputStream alloc]initWithURL:[NSURL URLWithString:@"https://sitestream.twitter.com/1.1/site.json"]];;
_twitterStream.delegate = self;

[_twitterStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
                   forMode:NSDefaultRunLoopMode];

and adding Delegate Methods, but this is not working.

Thanks!


#2

I have a solution using NSURLSession here: https://stackoverflow.com/questions/45416117/twitter-streaming-api-objective-c/45503419#45503419