FAQ Database Discussion Community


How to retrieve JSON multi data with AFNetworking?

ios,swift,afnetworking
I'm using AFNetworking Library with Swift. When I retrieve single data json like [{a:"xxx",b:"yyy"}] , it is succeeded. But when I retrieve multi data json like [{a:"xxx",b:"yyy"},{a:"mmm",b:"nnn"}], it failed. let manager:AFHTTPRequestOperationManager = AFHTTPRequestOperationManager() let serializer:AFJSONRequestSerializer = AFJSONRequestSerializer() manager.requestSerializer = serializer manager.GET("http://www.test.com/member.json", parameters: nil, success: {(operation: AFHTTPRequestOperation!, responsObject: AnyObject!) in let...

Error in opening .xcworkspace

ios,signalr,afnetworking,cocoapods,socketrocket
I integrated pods in my project specifically SignalR, AFNetworking and SocketRocket. It was successfully installed, but when I opened .xcworkspace, this error shows: Has anyone encountered this kind of error? Thanks in advance. Update: My .xcodeproj has appeared. But the frameworks appear red. How can I solve this? ...

Jsonobject + Image Multipart AFNetworking

ios,objective-c,afnetworking,multipartform-data
We are trying to send multi-part request to server using AFNetworking. We need to send one json object and two image files. Following is the curl request for same. curl -X POST http://localhost:8080/Circle/restapi/offer/add -H "Content-Type: multipart/form-data" -F "offerDTO={"code": null,"name": "Merry X'Mas - 1","remark": "25% discount on every purchase","validityDate": "22-12-2014","domainCode": "DO...

AFNetworking: how to get the response string when failed?

ios,afnetworking
I am using - (AFHTTPRequestOperation *)GET:(NSString *)URLString parameters:(id)parameters success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; to communicate with the server, and it works great. But sometimes, there is an error on the server, and it's response is not in json format. My partner wants me to show...

AFNetworking 2.0 Cache Issue

ios,objective-c,caching,afnetworking
Does AFNetworking cache still work for objective-C? I have been trying to cache API response using AFNetworking, but it seems not to work anymore. AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSString *requestURL = [NSString stringWithFormat:@"http://ssssssssss.com"]; manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; [manager.requestSerializer setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; [manager GET:requestURL parameters:nil...

Swift: Dynamic Library And AFNetworking

swift,afnetworking,dynamic-library
I have a problem integrating AFNetworking in my Swift Dynamic Library: Here is what I have done: Create Xcode Project: ( Cocoa Touch Framework ) Initialize Pod: ( pod init ) via Terminal Modify Podfile: Here is the content of the podfile, and execute (pod install) target 'MyFramework' do use_frameworks!...

iOS App Signup Error

ios,login,afnetworking
I receive this error when I tried to signup an account with the app im building. May I know what does this error means? Thank you! BaseNetworkManager.m:164 Error Domain=AFNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), got 500" UserInfo=0x16d30560 {NSLocalizedRecoverySuggestion=meta http-equiv="refresh" content="0; url =websitelink.error.html" AFNetworkingOperationFailingURLRequestErrorKey=NSMutableURLRequest: 0x16670d80> { URL: mywebsite/users.json }, NSErrorFailingURLKey=h...

Vimeo API - unacceptable content-type: text/plain

ios,afnetworking,vimeo,http-status-code-400,vimeo-api
I am using Vimeo API in my iOS application. But since few days it has stopped working, It gives me error while I am trying to upload any videos. Following is the way, I am creating the request NSURL *uploadURL = [NSURL URLWithString:endpoint]; OAMutableURLRequest *req = [[OAMutableURLRequest alloc] initWithURL:uploadURL consumer:self._oaconsumer...

what is the use of UIWebview+AFNetworking class?

ios,uiwebview,afnetworking
I have observed in AFNetworking class 2.5.4 that UIKit+AFNetworking folder has been included.What is the use of various classes used in that folder and How can post request in a webview using UIWebview+AFNetworking class.

How to Upload Images Using AFNetworking directly from iPad app

ios,ipad,afnetworking
I am totally new to iOS.I want to upload images to my server using AFNetworking. I tried it but it still not done. Please Help me, thanks in advance

Perform UI changes before performing AFNetwork request

ios,swift,asynchronous,afnetworking
I have a UIButton in a login view controller that when pressed, fetches the value from a UITextField and performs a POST request to a server, via AFNetwork. I wanna hide the text field and display a UIActivityIndicatorView right after the button is pressed, so that the user sees that...

fail to set timeoutInterval when using subclass of AFHTTPRequestOperationManager

ios,cocoa-touch,afnetworking
all I made a subclass of AFHTTPRequestOperationManager and wanted to set timeout to 3 seconds. [netMgr.requestSerializer setTimeoutInterval:3.f]; But it doesn't work. I can figure out that it's because the auto key value observing returns NO in automaticallyNotifiesObserversForKey when the key is timeoutInterval Could anyone tell me the reason, or what's...

Getting the count (number of items) in a json response in swift

ios,json,swift,casting,afnetworking
I am on the process of learning swift now. I have used ANetworking (library in Obj C) in my swift code. I have successfully been able to return the parsed JSON. However I would want to find the count of the json items that are returned. Here is what I...

AFNetworking 2.0 AFHTTPRequestOperationManager CachePolicy not working

ios,afnetworking,nsurlcache
I'm trying to make a GET request to a server with an If-Modified-Since header in order to avoid loading identical content. When I make a request I know that the server is sending back a 304 indicating that the content has not changed, but NSURLCache or AFNetworking is responding with...

AFNetworking issue with UStream API request for channel's video list

ios,afnetworking,afnetworking-2,afhttprequestoperation,nsurlerrordomain
This is probably something simple that I am just overlooking. I am trying to make an AFHTTPRequest from uStream's API using AFNetworking. I should be getting a JSON payload response back that lists all the videos on a uStream Channel. Here is my code: NSURL *url = [NSURL URLWithString:@"https://api.ustream.tv/channels/12321320/videos.json"]; NSURLRequest...

unable to register an user using afnetworking

ios,json,login,afnetworking,http-status-code-401
I want to create a user to a back-end server, I need to enter following information to register user. { "user": { "email": "[email protected]", "password": "secret", "password_confirmation": "secret", "seed_recipes": true //optional } I wrote following code for registering a user: AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; NSDictionary...

AFNetworking & “Undefined symbols for architecture i386”

ios,xcode,afnetworking
I have a problem with AFNetworking & my project. It's not the first time that I included in one of my project but I have never encountered this error before. I added AFNetworking manually (just copy & paste the folder) and set #import "AFNetworking/AFHTTPRequestOperationManager.h" in one view controller, but when...

How to parse JSON dictionary inside object

ios,objective-c,json,uitableview,afnetworking
I am given the following JSON object. I am required to take the schedule and display the values inside of a table view converting them to the users local time zone. I am okay converting the time, however I am a little confused about how I should go about retrieving...

iOS - Use AFNetworking with custom NSURLProtocol class

ios,objective-c,http,afnetworking,nsurlprotocol
I have a custom NSURLProtocol class that I have implemented with the help of this tutorial. My implementations are pretty much the same as in the tutorial, aside from the names, data model, etc... Essentially, I am trying to send a HTTP request, but instead of the URL starting with:...

UIImageView+AFNetworking Managing Caching & Allocations

uitableview,uiimageview,afnetworking,nsurlcache,image-caching
I am using the UIImageView+AFNetworkingin order to download and display an image from a URL in a UITableView. Everything is working great and my question is around the caching elements & allocations that are implemented with this call. In using instruments to track memory I see that as I scroll...

AFNetworking and its Repsonse (JSON). Simple check a value does not work?

ios,xcode,apple,afnetworking
I have a problem with AFNetworking and its Response. For you, this will be very simple to solve?! :-D I receive a response as a json and then i use the values of the response. The response in the log looks as follows: { data = { name = john;...

Wanting to use the data I get back when using AFNetworking

ios,objective-c,afnetworking
I am using AFNetworking to get a JSON response. I am getting is as a PhotoPXArray (model I created using mantle). The log output is exactly the data I want. My problem is using the data. How do I go about saving the response data as a variable that can...

Caching in AFNetworking+UIImageView doesn't respect any http cache policy? (hopefully I'm wrong)

ios,caching,afnetworking
It seems if I call: setImageWithURLRequest:(NSURLRequest *)urlRequest placeholderImage:(UIImage *)placeholderImage success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure That the resulting image will be put into AFNetworking's AFImageCache regardless of any cache policy set in HTTP response headers and will remain there and be fetched...

Download a file with AFHTTPSessionManager and with authentication

ios,oauth-2.0,afnetworking,afnetworking-2
I'm working on an iOS app using OAuth2 authentication. I'm authenticated, I have no problem requesting my API, but I'm facing a problem when trying to download some files from protected URLS. I'm using downloadTaskWithRequest from AFURLSessionManager (AFNetworking). It returns always an error 401 (not authorized) as if I was...

AFNetworking : Image is not uploading pre iOS 8

ios,afnetworking,image-uploading
I'm using AFNetworking in my app to make possible client-server communication. Its working great. But today, our tester encounter an issue, that we can't upload an image to the server on device which having iOS 7.0. and 7.1. (Note: we're targeting app from iOS 7.0. >= versions) We've encountered this...

how to post parameter like {“register_id”:“3”} in AFNetwroking

post,methods,parameter-passing,afnetworking,raw-data
i Tried it but didn't work in AFNetworking only showing parameters error but i used postman to check and when i send data via key and value it showing error but from raw data i send {"register_id":"3"} then it will show me data so how to post parameter like this...

How does the AFNetworking client decide when to disconnect during a POST operation

php,ios,json,client-server,afnetworking
I want to optimize my connection time during an afnetworking Post session. I use afnetworking to post from iOS to a server running PHP, and it receives a json confirmation message. The confirmation message happens instantly, but a lot of processing occurs on the data, I'm just wondering if the...

AFNetworking response failure block is called instead of success block

ios,objective-c,iphone,afnetworking
AFNetworking response failure block is being called when I get status code 200. How can I make the success be called instead? AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager GET:@"http://128.199.94.58/test/bt/client_token.php" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { self.clientToken = responseObject[@"customerID"]; NSLog(@"Client Token received."); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { // Handle failure...

Parsing a xml file in afnetworking and retrieve data doesn't work

xml-parsing,afnetworking
With this url I tried but it doesn't work. Can someone help me to give simple xml parsing code and retrive data from this url? http://dynamic.feedsportal.com/pf/555218/http://toi.timesofindia.indiatimes.com/rssfeedstopstories.cms I tried but only reached at NSData * data1 = (NSData *)responseObject; NSString *fetchedXML = [NSString stringWithUTF8String:[data1 bytes]]; NSLog(@" xml data :: %@", fetchedXML);...

Asynchronous block call to self crashes with EXC_BAD_ACCESS in Swift

ios,swift,afnetworking
I have an API call (using AFNetworking) that when fails calls a failure block. This block simply stop the table view refresh controller via 'self.refreshController.stopRefreshing(); However at run-time this causes a EXC_BAD_ACCESS error. failure: { (error: NSError!, reason: String!) -> Void in self.refreshController.endRefreshing() } I've tried putting the call in...

How do I make a BasicAuth REST query over SSL with python3

python-3.x,afnetworking,urllib
I have a tornado server that acts as a REST interface to an iPhone app. I want to do some queries against said server using a python program. On the iOS side, I'm using the AFNetworking library. But I don't know what the analogs are on the python client side....

From ASIHTTPRequest to AFNetworking

ios,objective-c,afnetworking
I am following a tutorial about Multithreading from http://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial. In this tutorial ASIHTTPRequest is used and I see that AFNetworking has pretty much become the standard now. I am trying to download a zip file using this block: __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:sourceURL]; [request setCompletionBlock:^{ NSLog(@"Zip file downloaded."); NSData...

Get url shortened with Google API, AFNetworking in Swift

api,swift,url,afnetworking
In Google documentation (https://developers.google.com/url-shortener/v1/getting_started), to use Google URL shortener, I should make a request as below: POST https://www.googleapis.com/urlshortener/v1/url Content-Type: application/json {"longUrl": "http://www.google.com/"} They also stated that I will have to authenticate: "Every request your application sends to the Google URL Shortener API needs to identify your application to Google. There...

UITableViewAutomaticDimension + AFNetworking

ios,iphone,uitableview,cocoa-touch,afnetworking
I'm loading images from an API, and they have different heights and displaying in a UITableView which contains other type of cells (the reason I'm using UITableViewAutomaticDimension) I wanted to display (or reload) the cells containing the images using the image height, to avoid distortion. I tried different solutions, but...

What is the proper way to display a loading indicator while getting data from a URL

ios,objective-c,json,afnetworking
I'm somewhat new to objective-c, i'm developing a news iOS application, the app gets all its contents using JSON parsing from a url, i'm using AFNetworking for that and this is the method that i made: - (void)getContents { NSString *urlString = @"http://some-url-that-has-json-output/"; urlString = [urlString stringByAppendingString:self.articleId]; NSLog(@"The call url...

RestKit / AFNetworking - Send only one request at a time (queue)

ios,objective-c,rest,afnetworking,restkit
I'm using RestKit / AFNetworking to communicate with a private api. This API is returning a cookie with a sessionID on every call. If you do a call with an already used sessionID it will return an error. So every sessionID can only be used once. The issue is that...

SWIFT IOS return 2 different objects in a same function

ios,iphone,swift,return,afnetworking
I want to return request if all went well and return error if something went wrong. func afnwPost(url: String,client_id: String, client_secret:String,grant_type:String, userparam: String, passwordparam:String)-> AnyObject{ var parameters = ["client_id":client_id,"client_secret":client_secret,"grant_type":grant_type,"username":userparam,"password":passwordparam] manager.POST( url, parameters: parameters, success: { (operation: AFHTTPRequestOperation!,responseObject: AnyObject!) in println("JSON: " + responseObject.description) return...

Need to execute only one HTTP operation in AFNetworking and cancel the previous one

ios,objective-c,afnetworking
I use the AFNetworking framework and need to implement this logic to my web requests: only one request is executing; if the new request is ready I need to cancel the previous one and execute the new one. I see that AFHTTPRequestOperation is a NSOperation subclass, so I can write...

Afnetworking 2.0 PUT image

objective-c,afnetworking
I am able to use put method of afnetworking 2.0 successfully for putting data. NSString* PUTURL = [NSString stringWithFormat:@"%@/updateestado/estado/%@/idJugador/%ld",BASEURl,[status urlEncodeUsingEncoding:NSUTF8StringEncoding],userId]; NSLog(@"REG URL----%@",PUTURL); AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager PUT:PUTURL parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@", responseObject); [self.NET_Delegate...

Ui view freez for long time

ios,afnetworking
I am working on afnetworking, i have web service that takes too much time to load data and i want that UI do not freeze, i used this tutorial to run webservice on background so that i can work on other views as well, but not sucess till yet. -(void)...

Reusing an UIImage object in an UIImageView that is retrieved with “setImageWithURL”

ios,objective-c,iphone,uiimage,afnetworking
I have tableview that consists of cells of Youtube thumbnails that is retrieved with the help of AFNetworking's setImageWithURL method. So how do I re-use the thumbnails in these cells to another view? Thanks in advance....

AFNetworking setImageWithURLRequest not updating UIImageView

ios,objective-c,uiimageview,afnetworking
I am downloading an image from a URL using setImageWithURLRequest:placeholderImage:success:failure and the download of the image works correctly. The issue I am having is that when I set the downloaded image to the UIIMageView nothing shows but the placeholder is removed. My code is as follows: __weak UIImageView *userCardImageView; AFImageResponseSerializer...

Trying to port code to AFNetworking 2.0

ios,xcode,afnetworking,afnetworking-2
I am trying to port the following code to AFNetworking 2.0 //load the image API* api = [API sharedInstance]; int IdPhoto = [[data objectForKey:@"IdPhoto"] intValue]; NSURL* imageURL = [api urlForImageWithId:[NSNumber numberWithInt: IdPhoto] isThumb:YES]; AFImageRequestOperation* imageOperation = [AFImageRequestOperation imageRequestOperationWithRequest: [NSURLRequest requestWithURL:imageURL] success:^(UIImage *image) { //create an image view, add it to...

Displaying JSON Data from URL using AFNetworking

ios,xcode6,afnetworking
I want to display json data from a URL. Everything Works the data array is accessible in only did load section. When I use it to count count it gives NULL but inside did load it works. What is the issue. .h file @interface ViewController : UIViewController<UITableViewDataSource,UITableViewDelegate> { NSDictionary *dictArray;...

How to parse a response obtained with AFNetworking 1.0 using JSON format

ios,objective-c,json,post,afnetworking
I'm having a problem with AFNetworking. Currently I can send a POST request in JSON format [AFJSONParameterEncoding] using NSDictionary to a server and it correctly replies, the problem is that the server replies with a JSON formatted response too, response I'm able to convert to NSString using: [[NSString alloc] initWithData:responseObject...

Use AFNetworking to create a parse.com pointer object through REST API

ios,rest,parse.com,afnetworking
I'm trying to use AFNetworking to call the parse.com REST API. GET-Requests are working quite well so far. But when it comes to object creation I have a problem creating relations (pointers to object-ids) between two parse objects. What I've tried so far: NSString* parameterString = [NSString stringWithFormat:@"{\"__op\":\"AddRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"MyClass\",\"objectId\":\"%@\"}]}", myClassObjectId]; NSDictionary...

How to use Alamofire with custom headers for POST request

swift,post,header,afnetworking,alamofire
I implemented a POST request with Alamofire with a custom header, because we work with OAuth2 and we have to send an access token in every request inside the header. In this case I have to use a custom header. The access token value for the HTTP header field Authorization...

UITableViewCell image not shown until selected

ios,objective-c,uitableview,swift,afnetworking
My UITableViewCells images are displaying until I scroll back upwards whereby the images would not be displayed until the cell is selected. The same problem also happens when I switch from another ViewController to the initial ViewController*(which contains the image)* I have checked that the imgURL of the image is...

Taking is JSON data in AFNetworking

ios,json,afnetworking
So I have AFNetworking working just fine, I can get json data and format it in a tableview as long as the JSON file as an Array called "results." Example: { "results": [ { "title": "title", "subtitle": "subtitle", "description": "", "image": "" } ] } My code in xcode to...

Is it safe to pass a view controller as an argument to AFNetworking request?

ios,afnetworking
Is something like this is not a memory leak or other issues? - (void) requestAndUpdateView: (UIViewController *) vc { [afHttpManager POST:.... success:^(....){ [vc doSomething]} ... ... ]; } ...

afnetworking get json data out from response

ios,objective-c,json,afnetworking
I am trying to extract data(just a string) from request and set it to the NSString. I tried it in many way but it is not working. If anyone can point out my mistake, it will be very helpful for me. json data { "status": 1, "key": "1e39248f4a5e05153dc376a" } My...

In AFNetworking, what does #ifdef _SYSTEMCONFIGURATION_H mean?

ios,xcode,afnetworking
This check is in my AFHTTPClient.m file. The check is actually used very frequently throughout the file and the .h file. In one case, it does this: #ifdef _SYSTEMCONFIGURATION_H self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown; [self startMonitoringNetworkReachability]; #endif This is still version 1.X of AFNetworking. Thanks!...

kCFStreamErrorDomainSSL, -9802 when connecting to a server by IP address through HTTPS in iOS 9

ios,iphone,afnetworking,ios9
We have an iOS app that connects to our server through HTTPS. When the app is built with the new iOS 9 SDK and ran under iOS 9, the following error occurs: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) The app uses AFNetworking 1.3.4 with pinned certs. The problem occurs if...

Compiler Errors Adding AFNetwork to Xcode

ios,xcode,afnetworking
I've looked at all the questions on StackOverflow regarding this, and nothing has helped. I followed this tutorial for setting up the AFNetworking library with xcode to use for my project, however I am getting this error in the AFURLSessionManager.m file: Semantic Issue: @synthesize of 'weak' property is only allowed...

Get NSData straight from AFNetworking 2.~

ios,objective-c,afnetworking
I am using AFHTTPSessionManager and I don't want the response data to be serialized. Is there any way to do this without using AFHTTPRequestOperationManager?

AFNetworking 2.0: Subclassing AFHTTPSessionManager for TDD causing error in AFURLRequestSerialization init

ios,objective-c,unit-testing,afnetworking,afnetworking-2
I've subclassed AFHTTPSessionManager in order to make a mock out of it to use while testing. However, I keep running into a BAD_ACCESS error in AFURLRequestSerialization's init method - only with the mock. Here's the setup: Testing class: @interface PLBookCommunicatorTests : XCTestCase @end @implementation PLBookCommunicatorTests { MockAFHTTPSessionManager *httpSessionManager; HKCommunicator *communicator;...

setImageWithURL in AFNetworking 2.0

ios,afnetworking,afnetworking-2
In AFNetworking 1.x, we could use setImageWithURL in a way like this: NSURL* imageURL = [api urlForImageWithId:IdPhoto isThumb:NO]; [photoView setImageWithURL: imageURL]; } where IdPhoto is the Id of the Photo I am trying to load into an image view. This code doesn't work in AFNetworking 2.0. I think I have...

AFNetworking can sometimes not connect using some WiFi networks

ios,objective-c,wifi,afnetworking
We have an iOS app which makes a number of API calls to a remote server. We first check whether we have an internet connection, and then make all the API calls. We are using the AFNetworking 1.0 library for this. NSMutableURLRequest *request = [[self.class sharedNetworkHelper].httpClient requestWithMethod:HTTP_VERB_POST path:path parameters:parameters parameterEncoding:AFJSONParameterEncoding];...

iOS / Apple Watch: iPhone app network request callback blocks not triggered when app is in background

ios,objective-c,afnetworking,watchkit,apple-watch
My Apple Watch app sends a message to the companion iPhone app. In the main app's handleWatchKitExtensionRequest, I send a request to the server: - (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply { if ([[userInfo objectForKey:@"request"] isEqualToString:@"getPendingChallenge"]) { [MyClient getPendingNotifications:someId withDomain:host withSuccessBlock:^(id responseObject) { // process responseObject ... reply(response); return;...

How to check version of AFNetworking?

objective-c,xcode,afnetworking
I am thinking about upgrading my current project, but I don't know which version I have. Is there a way to tell?

iOS Objective-C AFNetworking dataTaskWithRequest:completionHandler: can't retrieve data from inside completition block

ios,objective-c,json,afnetworking
Here is my code: //create array with all the teams NSMutableArray *leagueTeams = [[NSMutableArray alloc] init]; //send request [[sessionManager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { NSDictionary *responseFromJSONDictionary = (NSDictionary *) responseObject; //copy the team's attributes into temp variables NSString *tempTeamIDCode = [responseFromJSONDictionary objectForKey:@"teamCode"]; NSString *tempTeamName = [responseFromJSONDictionary objectForKey:@"teamName"];...

library not found for -lPods-AFNetworking

ios,xcode,runtime-error,afnetworking,xcode-6.2
I am getting the following error when using AFNetworking: ''library not found for -lPods-AFNetworking'' "linker command failed with exit code 1 (use -v to see invocation)." I checked for all missing frameworks,and they are all present .Additionally this project works for other people(we pulled it from github) and I'm the...

Saving image from url to disk not working

objective-c,uiimage,afnetworking,afnetworking-2
I'm trying to download an image from an url in my app, so that it can be used by the Today Extension. So I call [self downloadImageFromUrl:imageOne];, which uses this method: - (void)downloadImageFromUrl:(NSString *)url { NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; requestOperation.responseSerializer = [AFImageResponseSerializer...

which one is better to wrap AFNetworking functions in one file or use it in separate files,

ios,coding-style,afnetworking
I'm using AFNetworking as network library. There are two different coding styles and I don't know which one is better. Wrap all functions that associated to network to one file. For example, I have a singleton file called API.m, and I wrapped login function as below: - (void) login:(NSString *)username...

How to convert NSURLConnection to AFNetworking?

ios,objective-c,xcode,afnetworking,afnetworking-2
i want to convert this code to AFNetworking but i have a error. i used AFNetworking POST to REST webservice this code. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; NSString *latest_url = @"url_string"; [request setURL:[NSURL URLWithString:latest_url]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setValue:useragent_string forHTTPHeaderField:@"User-Agent"]; [request...

AFNetworking swift JSON AnyObject casting

ios,swift,afnetworking
In result of AFNetworking response I got AnyObject dictionary like structure, which is not casting as Dictionary and fails with error. So I've used structure as following if let data: AnyObject = responseObject["data"]! { if let current_condition: AnyObject = data["current_condition"]! { print(current_condition.valueForKey("FeelsLikeC")!) } } That gave me some result which...

OSX - AFNetworking sending text even with JSON Serializer set

objective-c,osx,swift,afnetworking
I have an issue with AFNetworking and AFJSONRequestSerializer. I try to access an API, and the request contains a text/plain header. Here's my code : class BaseService { var manager: AFHTTPRequestOperationManager! init() { manager = AFHTTPRequestOperationManager() manager.responseSerializer = AFJSONResponseSerializer() manager.requestSerializer = AFJSONRequestSerializer(writingOptions: NSJSONWritingOptions.allZeros) } } class UserService: BaseService { func...

Cancel previous request of AFHTTPSessionManager

ios,objective-c,afnetworking
I have a textfield, whenever user enter character, I am appending that character to my url and get the response. I need to cancel previous request. For example if I type "shampoo" I will be hitting server 7 times and I need to cancel last 6 request. currently I am...

AFNetworking 2 empty POST response but no errors

ios,ios8,afnetworking
It's a very tricky problem: I do a POST request (login) to a server. The server will answer: ok Status Code: 200 + JSON Data error Status Code: 401 + plain/text Code: func login (id: String, password: String){ self.responseSerializer = AFJSONResponseSerializer() self.responseSerializer.acceptableContentTypes = nil self.responseSerializer.acceptableStatusCodes = NSIndexSet(index: 400) //self.responseSerializer.acceptableStatusCodes =...