Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearrange else-if in Request.init to fix iOS 7 fatal error. #34

Merged
merged 1 commit into from
Aug 23, 2014

Conversation

jandrewmoore
Copy link
Contributor

See my comments on Alamofire Issue 29 here.

@mattt
Copy link
Sponsor Contributor

mattt commented Aug 14, 2014

Hmm... following your findings, I don't understand how this would produce the desired behavior. In the case of an if / else statement, if certain cases overlap, it should go from most specific / exclusive to least. Unless I have it wrong, shouldn't it be testing download, then data, then upload?

@yonaskolb
Copy link

Can confirm this fixes a fatal crash on iOS 7

@jandrewmoore
Copy link
Contributor Author

It is in order of specificity. I think I wrote confusingly. task is NSURLSessionUploadTask only returns true for upload requests, but task is NSURLSessionDataTask returns true for upload and data requests, and task is NSURLSessionDownloadTask returns true for all kinds of requests. So the delegate was being set to handle download tasks instead of data tasks.

@kriswallsmith
Copy link

This fix allows me to use Alamofire on the iOS 7.1 simulator. My .response callback was getting nil instead of an NSData before.

mattt added a commit that referenced this pull request Aug 23, 2014
Rearrange else-if in Request.init to fix iOS 7 fatal error.
@mattt mattt merged commit dfb4172 into Alamofire:master Aug 23, 2014
@mattt
Copy link
Sponsor Contributor

mattt commented Aug 23, 2014

Thanks, @jandrewmoore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants