Skip to content

[SR-2226] NSURLSessionConfiguration initializer shouldn't be available #4345

Description

@swift-ci
Previous ID SR-2226
Radar None
Original Reporter Zyphrax (JIRA User)
Type Bug
Status Resolved
Resolution Invalid
Environment

Swift 2.1, Xcode 7.3.1

Additional Detail from JIRA
Votes 2
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 90d9f3752eaa802e02564704deb0df91

Issue Description:

The proper way to create a NSURLSessionConfiguration is to use one of these three methods:

  • defaultSessionConfiguration

  • ephemeralSessionConfiguration

  • backgroundSessionConfigurationWithIdentifier

However the compiler allows me to create a new NSURLSessionConfiguration through the parameterless initializer:

NSURLSessionConfiguration()

When you run the code after that, you get weird runtime errors:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: [NSURLSessionConfiguration setTimeoutIntervalForRequest:] unrecognized selector sent to instance 0x7fb1b2dd2a30

It would be great if using the mentioned initializer would throw a compile error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions