mxcl / PromiseKit

Promises for Swift & ObjC.
MIT License
14.23k stars 1.46k forks source link

Deprecated method use in NSURLConnection+Promise #369

Closed rlaferla closed 8 years ago

rlaferla commented 8 years ago
            NSURLConnection.sendAsynchronousRequest(request, queue: Q, completionHandler: { completionHandler($1, $0, $2) })

'sendAsynchronousRequest(_:queue:completionHandler:)' was deprecated in iOS 9.0: Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h
nathanhosselton commented 8 years ago

Unfortunately there are a number of methods/classes used among the PromiseKit categories that were deprecated in iOS 9 that we will have to continue to support for the time being (UIAlertView etc). I've looked into updating this specific method but it does not trivially map to its replacement. I'll leave this open anyway because unlike the other deprecations it should be possible to update this one without breaking the API. PR welcome.

mxcl commented 8 years ago

I've removed deprecated stuff from PMK4 since it has been two years since the deprecation now. They are going to be still available in a subspec. Nothing else we've been able to do, removing them outright earlier would have been outrageous to people who needed them. CocoaPods doesn't let us turn on no warnings, and you can't turn off warnings in the source code in Swift (just objc).

pixelknitter commented 7 years ago

@mxcl you mentioned a subspec for the NSURLConnection category that can be used in PMK4, where does this live? I plan to migrate over to different methods, but after a migration to Swift 3, etc needed to upgrade.

mxcl commented 7 years ago

https://github.com/PromiseKit/Foundation

FFR you can read the .podspec file for any CocoaPod to have a direct pointer to where things live.

Edit: OK, there is no subspec for NSURLConnection actually. I never wrote that, I think. Sorry.

If it's any consolation I didn't want to remove it, but CocoaPods and Apple's tooling provide no way around this, keeping them there results in warnings for all users. So they had to be removed rather than force all users to ignore warnings or disable them.

mxcl commented 7 years ago

It's a single file though, so you can just drop it into you project and it'll just work.