site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1508277978; bh=04HcwUlFce8t4UskzmQRWIi+cSruI7pDD8AenVRDlIY=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=nvuoQlObn/qGHfqA5hEKCGVlbw1F9M+OxCcx3iHLhOPPMHMmi+b3hZ/f3htrwz31ECjL1QBdCAiVqX4lCovtS4tsWakRRunfFhN0TXA5oI+IxSiR4NvUAOht6UjXRtlNzamtayCt9UxHT8ScIeL9R9Q5df1qJRHOHk9kVFymT2hmqzWf8pAO+CDaGqAWqJWe4yGaEhoTYArzKgXqNVrImDvujax0Tbt0vxx6PqztuqiE2hYf/La3f3cmBP5YVg4wtlEc6k4gYU3E8AQb10OtH0CHZHU5GiHKSeGuNVx0ajVmMCj75B89YZ1SdsyHKDluY9KFgs0h5PW9819y2OzkcA== I have the following (simplified) code snippet: [myURLSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response; NSUInteger responseCode = httpResponse.statusCode; (do something based on responseCode value) .... }] resume]; 'request' is a NSURLRequest to an HTTPS server. I've noticed that most times, the response will come back as a NSHTTPURLResponse, other times only as a NSURLResponse (which leads to a crash when I try to get the -statusCode). I haven't been able to determine why/when NSURLSession will return a NSHTTPURLResponse vs a NSURLResponse (the requests always go to a HTTP server, with a http(s):// scheme). I would expect that since the request is sent to a HTTP server/scheme, it would always return a NSHTTPURLResponse object. What would make it a NSURLResponse (when a valid response is returned) instead of a NSHTTPURLResponse? _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists... This email sent to site_archiver@lists.apple.com