1

In my objective C project i am using

  • Segment 1).
[(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'

  • Segment 2).
(NSString *)kCFStreamPropertyHTTPProxyHost

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

steveSarsawa
  • 1,559
  • 2
  • 14
  • 31
Amit
  • 556
  • 1
  • 7
  • 24

1 Answers1

0

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.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • Rob firstly thanks :) . For Qw1) is there any replacement for `CFReadStreamCreateForStreamedHTTPRequest` ? Qw2). is `kCFStreamPropertyHTTPProxyHost ` & `kCFNetworkProxiesHTTPProxy ` same ? – Amit Jul 25 '19 at 08:01