When URLSession.dataTask(with request: URLRequest, completionHandler:) returns a nil error, is the URLResponse response parameter guaranteed to be an HTTPURLResponse, so that it is safe to force downcast the URLResponse to an HTTPURLResponse?This article does not force cast the URLResponse to an HTTPURLResponse when there is no error:https://developer.apple.com/documentation/foundation/url_loading_system/fetching_website_data_into_memoryThese examples do:https://developer.apple.com/documentation/network/debugging_http_server-side_errorshttps://forums.developer.apple.com/message/351326#351326Thanks!
Post
Replies
Boosts
Views
Activity
Does CFNetwork provide API to open a socket on a particular interface? This post suggestsusing SCNetworkInterfaceCopyAll and SCNetworkInterfaceGetInterfaceType to find an interface with a desired type. But I get an error saying SCNetworkInterfaceCopyAll is unavailable in Xcode 8.3.2.If SCNetworkInterfaceCopyAll is unavailable, how would you search the result of getifaddrs to find an interface with a type (e.g. kSCNetworkInterfaceTypeIEEE80211 (wifi) vs kSCNetworkInterfaceTypeWWAN (cell)).Thanks!