Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:39:48+00:00 2026-05-28T06:39:48+00:00

I am starting up with AFNetworking to replace the sadly-defunct ASIHTTPRequest. People seem to

  • 0

I am starting up with AFNetworking to replace the sadly-defunct ASIHTTPRequest. People seem to love this new “AFNetworking” but it doesn’t build in my project and I can’t figure out why. I’m getting build errors starting on Class class = NSClassFromString(className); in HTTPRequestOperationWithRequest:success:failure in the file AFHTTPClient.m.

The error is “Declaration of anonymous class must be a definition” and I have asked teh google but not gotten anything. Help?

Context:

- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)urlRequest 
                                                    success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                                                    failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
    AFHTTPRequestOperation *operation = nil;
    NSString *className = nil;
    NSEnumerator *enumerator = [self.registeredHTTPOperationClassNames reverseObjectEnumerator];
    while (!operation && (className = [enumerator nextObject])) {
        Class class = NSClassFromString(className);
        if (class && [class canProcessRequest:urlRequest]) {
            operation = [[(AFHTTPRequestOperation *)[class alloc] initWithRequest:urlRequest] autorelease];
        }
    }

EDIT: Solved per answer below. Patch file here.

EDIT 2: These changes have been pulled into the newest AFNetworking, so anyone finding this in the future: Just download a fresh version and you’re all set. Also, how’s the future? Hello future.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:39:49+00:00Added an answer on May 28, 2026 at 6:39 am

    I was able to get around the compiler error by renaming the variable “class” to something else. Unfortunately, I was not able to figure out why I was getting the problem. Here’s a clue: it happened to me when I added AFNetworking to a big existing project with unknown compiler flags. When I added AFNetworking to a fresh new project, I didn’t hit the problem at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Starting a project, and this irriating me. I think the code is okay, but
Starting with a recent new version of ADT, I've noticed this new attribute on
Starting a new rails project and we have a well-thought-out color palette, and want
Starting a new project in Xcode 4 - what's the best way to make
Starting a new project and would like to use one of the MVC framworks.
Starting with this code: new Person(ET).WithAge(88) How can it be refactored to: new Person(ET,
Starting a new project I'd like to use Hibernate annotations with MySQL instead of
starting a new project and want to try using the storyboard feature of xcode
Starting from an Html input like this: <p> <a href=http://www.foo.com>this if foo</a> <a href=http://www.bar.com>this
Starting from an Html input like this: <p> <a href=http://www.foo.com>this if foo</a> <a href=http://www.bar.com>this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.