Tag: afnetworking

Using AFNetworking and HTTP Basic Authentication

The following code successfully connects to my Ruby on Rails API and returns JSON using AFNetworking. What do I need to do to edit this to pass in a username and password so my API can use HTTP Basic Authentication? I’ve read their documentation, but I am new to both Objective-C and AFNetworking and it […]

Return value for function inside a block

I am using AFNetworking to get data from a server: -(NSArray)some function { AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success: ^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { NSArray *jsonArray =[JSON valueForKey:@”posts”]; } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {} } So what I am trying to do here is to return the jsonArray to […]

How can I save a html file with external resources using AFNetworking?

I would like to save a .html webpage with AFNetworking, but would also like to save the resources (such as .css files, .js files, images etc) within the webpage so that the whole webpage can be viewed offline. Is this possible with AFNetworking, and how would I do it? Could a short example be posted […]

Pass response from AFHTTPRequestOperation to UIWebview

My code is making two requests to the server. One into the uiwebview directly and one with the AFHTTPRequestOperation. I’d like to use the AFHTTPRequestOperation and just pass the response into my uiwebview. What is the correct syntax for passing the response into the uiwebview and not loading it again? How do I do that […]

-fno-objc-arc not working to disable ARC

I have tried the solution found in this post to disable ARC in AFNetworking files, but to no avail: Any ideas where I am failing? Obviously the simpler the answer the better. I have also read that creating static libraries may help, but this seems complicated. EDITS I have tried deleting derived data and Clean […]

Xcode: ld: library not found for -lAFNetworking

Because of this one reason, build always fails…Any ideas about what I could try? EDIT: the solution is to open the xcworkspace instead of the xcproject!

iOS memory usage increasing, can't find the culprit

I’m attempting to download a large number of images using AFNetworking 2.5 and stream them to disk. According to the memory monitor in Xcode, this is causing unbounded memory growth (and eventually memory warnings and force quits) – but profiling the memory usage using the allocations instrument shows the memory usage to be stable. I’d […]

I'm getting compiler warnings with AFNetworking, but shouldn't be. How do I fix it?

I’m using the most excellent AFNetworking library in a project that I’m currently upgrading to iOS 6. I’m in the middle of the upgrade, whittling down the bunch of warnings that I get when compiling against the iOS 6 SDK. AFNetworking gives me two warnings in all targets: SystemConfiguration framework not found in project, or […]

Restkit Authorization Header disappears

I already searched everywhere and this issue that should have been trivial is taking longer than I wanted therefore I am reaching you for help. I am using swift and integrated restkit using cocoapods. Despite, as you can see the screenshots/log, the header is fine however the outgoing http packet is not consistent. AppDelegate: RKlcl_configure_by_name(“RestKit/Network”, […]

Could not find an overload for 'println' that accepts the supplied arguments

I’m porting my Objective-C code to Swift and got stuck with a weird error. I’m using a bridged version of https://github.com/AFNetworking/AFOAuth1Client if it helps. Can you please point me what’s wrong? Thank you. A working Objective-C code: [oauthClient authorizeUsingOAuthWithRequestTokenPath:@”oauth_request.php” userAuthorizationPath:@”oauth_authorize.php” callbackURL:[NSURL URLWithString:@”oob”] accessTokenPath:@”oauth_access.php” accessMethod:@”POST” scope:nil success:^(AFOAuth1Token *accessToken, id responseObject) { NSLog(@”Success: %@”, accessToken); } failure:^(NSError […]