Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

AFNetworking 2.0 - Fix empty content crash on AFHTTPSessionManager.post #4296

Merged
merged 2 commits into from
Feb 13, 2019

Conversation

jcravioto
Copy link

If you are consuming the AFHTTPSessionManager from swift on xcode 9.3 or above, this will crash when the response has no content (204). This is because of strict closure signature in swift.

If you are consuming the AFHTTPSessionManager from swift on xcode 9.3 or above, this will crash when the response has no content (204). This is because of strict closure signature in swift.
If you are consuming the AFHTTPSessionManager from swift on xcode 9.3 or above, this will crash when the response has no content (204). This is because of strict closure signature in swift.
@jcravioto
Copy link
Author

jcravioto commented Oct 3, 2018

@SlaunchaMan this pull request fixes #4176 .

@SlaunchaMan
Copy link
Contributor

Thanks for the PR! I’ll have to make a quick update to the 2.6 branch to get it to build properly on Travis, and then we can have this running.

@SlaunchaMan SlaunchaMan added this to the 2.7 milestone Oct 3, 2018
@jcravioto
Copy link
Author

Hi, has there been any update on this. Thanks

@sashaweiss
Copy link

Hi - has there been any movement on this? Running into the exact same problem.

Thanks so much!

@sashaweiss
Copy link

To follow up real quick, I think to fix this entirely it might be necessary to add a bunch more __nullables, in a variety of places...in my experiments, for example, I had to add them to setCompletionBlockWithSuccess, HTTPRequestOperationWithRequest, and HTTPRequestOperationWithHTPMethod as well. I think more or less anywhere that responseObject shows up (maybe only where it shows up in a success-block type?) it'll have to be annotated.

Thanks for exploring this, though - at the very least I now have a fork that I can use for the meantime!

@SlaunchaMan
Copy link
Contributor

@jcravioto Sorry for taking so long on this; for this to get merged and released, we need to get #4329 building successfully on Travis. It seems close, but failing for weird reasons. If you have some spare time to try to help fix it, we can get this out there.

@sashaweiss If we can get the above done, would you mind submitting a PR with your changes to add more nullability annotations?

@SlaunchaMan
Copy link
Contributor

And of course another option would be to upgrade to AFNetworking 3.x. :)

@sashaweiss
Copy link

Ugh I'd love to @SlaunchaMan...dependencies beyond my control unfortunately.

I'd be happy to open a PR with more nullability! I'll stay tuned here, and look into it hopefully soon.

@sashaweiss
Copy link

Hey @SlaunchaMan - opened a PR adding __nullable where appropriate at #4335. Figured I'd open it now so that when the Podfile fix PR and this one go through it'll be ready to go.

Thanks again for your help!

@sashaweiss
Copy link

Hey all, just wanted to check in post-holidays and see if there had been any movement on this, or if I could lend a hand?

Thanks so much!

@SlaunchaMan
Copy link
Contributor

Can you merge in the latest changes from the 2.x branch? Tests are now passing on CI!

@SlaunchaMan SlaunchaMan merged commit 34b0ffb into AFNetworking:2.x Feb 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants