Amit
Amit

Reputation: 645

What is replacement of CFReadStreamCreateForStreamedHTTPRequest?

In my objective C project i am using

[(NSInputStream *)CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream]) autorelease]

but CFReadStreamCreateForStreamedHTTPRequest is deprecated what can i write alternatively ?

I tried

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request

Error throws:-

Incompatible pointer types sending 'CFHTTPMessageRef' (aka 'struct >__CFHTTPMessage *') to parameter of type 'NSURLRequest * _Nonnull'

(NSString *)kCFStreamPropertyHTTPProxyHost

'kCFStreamPropertyHTTPProxyHost' is deprecated: Haven't found any replacement API.

Upvotes: 1

Views: 258

Answers (1)

rob mayoff
rob mayoff

Reputation: 385890

To use dataTaskWithRequest:, you need to create an NSURLRequest, not a CFHTTPMessageRef.

As for kCFStreamPropertyHTTPProxyHost, this question asks “How to programmatically add a proxy to an NSURLSession” and has an answer that looks good to me.

Upvotes: 0

Related Questions