NSMutableURLRequest return empty data with status code 200 on iOS 9 only

I have the following code that NSMutableURLRequest empty data for URL request only on iOS9.



-(void)getDataFromURLServiceCall:(NSString*)customerId {


self.receivedData = [[NSMutableData alloc] init];


NSDictionary* parameters = @{@"customerId": customerId,

@"ticket": appDelegate.vcsession.ticket};


NSString *parameterString = [self buildParameterStringFromDictionary:parameters];


NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://%@.MyURL/GetDataCall",self.configuration]]];

[request setHTTPMethod:@"POST"];

[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

[request setHTTPBody:[NSData dataWithBytes:[parameterString UTF8String] length:strlen([parameterString UTF8String])]];


[self sendRequest:request];

}



-(void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse *)response {


NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;


NSLog(@"status code: %ld", (long)[httpResponse statusCode]);


[self.receivedData setLength:0];

}



The following didReceiveData method returns empty data object. It only happens to iOS9.



-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {


NSLog(@"data---%@",[[NSString alloc] initWithData: data encoding:NSUTF8StringEncoding]);


[self.receivedData appendData:data];


}



This is the log.


2015-10-12 13:23:20.788 MyApp[7416:893478] status code: 200

2015-10-12 13:23:26.867 MyApp[7416:893478] data---[]

Is the NSData object itself empty, or is just the result of the NSString -initWithData:encoding: empty?

NSMutableURLRequest return empty data with status code 200 on iOS 9 only
 
 
Q