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

AFHTTPSession#delete attempts to call private method #118

Open
tmillican opened this issue Jun 17, 2021 · 1 comment
Open

AFHTTPSession#delete attempts to call private method #118

tmillican opened this issue Jun 17, 2021 · 1 comment

Comments

@tmillican
Copy link

I'm attempting to upgrade an app from afmotion 2.6.1 to 3.0, and I've run into an issue.

I have several calls like:

client.delete('some_url', params: { id: 3 }).do #etc

Which result in this crash:

2021-06-17 16:17:24.503 MyApp[34796:143989439] *** Terminating app due to uncaught exception 'NoMethodError',
reason: '/usr/local/var/rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/afmotion-3.0/lib/afmotion/client_shared.rb:81:
in `create_task:': private method `DELETE:parameters:headers:progress:success:failure:' called for #<AFHTTPSessionManager:0x600003d06a30> (NoMethodError)

Note: I have an unrelated issue with RM that's causing incorrect source locations to be reported for this project, but looking at the #create_task method, I can see this is where the call is actually dispatched to AFHTTPSessionManager.DELETE

Here is the full context of that method:

def create_task(http_method, path, options = {}, &callback)
  parameters = options.fetch(:params, {})
  headers = options.fetch(:headers, {})
  progress = options[:progress_block]

  method_signature = "#{http_method.to_s.upcase}:parameters:headers:progress:success:failure"
  success = success_block_for_http_method(http_method, callback)
  failure = failure_block(callback)
  method_and_args = [method_signature, path, parameters, headers, progress, success, failure]

  # HEAD doesn't take a progress arg
  if http_method.to_s.upcase == "HEAD"
    method_signature.gsub!("progress:", "")
    method_and_args.delete_at(4)
  end

  self.public_send(*method_and_args).   # <-- crashes here
end

I might be missing something, but from my reading of AFNetworking/AFHTTPSessionManager.h, it appears that HEAD is not the only exception for the progress parameter. In appears that only GET and POST publicly accept it.

@nickyhajal
Copy link

Did you figure this out? Experiencing the same thing

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

No branches or pull requests

2 participants