URLSessionConfiguration initializer should be marked unavailable
Originator: | jfriend | ||
Number: | rdar://34932508 | Date Originated: | 11-Oct-2017 09:56 AM |
Status: | Open | Resolved: | |
Product: | iOS + SDK | Product Version: | Swift 4/iOS11 |
Classification: | Other Bug | Reproducible: | Always |
Summary: The following code compiles with no errors: let sessionConfig = URLSessionConfiguration.default sessionConfig.timeoutIntervalForRequest = 10.0 But crashes at runtime with "Uncaught exception: -[NSURLSessionConfiguration setTimeoutIntervalForRequest:]: unrecognized selector sent to instance" because using the parameterless initializer is incorrect. Using `default`, `ephemeral`, or `background(withIdentifier:)` works. Steps to Reproduce: Compile above code in swift and run it. Expected Results: The parameterless initializer of URLSessionConfiguration should be marked as unavailable so that this incorrect usage does not compile Actual Results: Above code compiles fine, then crashes at runtime due to incorrect use Version: Swift 4/iOS11 Notes: I compiled using swift4 and ios11 sdks Related to this bug filed against swift itself: https://bugs.swift.org/browse/SR-2226
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!