afnetworking-2

Uploading image with AFNetworking with null parameter doesn't work

落花浮王杯 提交于 2019-12-31 05:45:27
问题 I want too upload the image to server but got error on doing that I have used following code but don't know whats wrong is in there +(void) HTTPPostImage:(NSString *) stringURL andParameter:(NSData *) imageData andSelector:(SEL) selector andTarget:(id) target{ AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:stringURL]]; // NSData *imageData = UIImageJPEGRepresentation(self.avatarView.image, 0.5); NSDictionary *parameters

Download file using AFNetworking on iOS 6

…衆ロ難τιáo~ 提交于 2019-12-30 11:19:14
问题 I've recently updated to AFNetworking 2.0. The documentation said it is compatible with iOS6.0+. I am building a iOS 6.0 app, when I am trying to implement a download method (both images and videos). The example use AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; However, I got an "Use of undeclared identifier 'AFURLSessionManager'" error. And I found out that AFURLSessionManager use a class that is only available from iOS7. I'm just

Loading an Image with AFNetworking 2.0

风格不统一 提交于 2019-12-30 06:32:06
问题 I'm trying to add a photo to a POST using the AFNetworking 2.0. This ios App sends a post an a photo to a blog. I can'f figure out why the images don't load. Here is what I got so far: // publish text and image -(void)publishTextAndImage:(NSString*)resultDisplay and:(NSString*)subject with:(NSString*)nonce { imageData = UIImageJPEGRepresentation(selectedImage, 0.7); // create a data object from selected image NSString *myUUID = [[NSUUID UUID] UUIDString]; // create a UUID NSString

setting limit on concurrent tasks in AFNetworking 2 running AFHTTPSessionManager

一个人想着一个人 提交于 2019-12-29 03:18:25
问题 so I know that in the old AFNetworking this was possible using the AFHTTPClient, and I know that if I use AFHTTPRequestOperationManager I can set the queue's limit, but I can't make AFHTTPSessionManager to run only x requests at a time without implementing it by myself using the success block (which I don't want to). The following code did NOT limit my connections: AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; manager.operationQueue.maxConcurrentOperationCount = 1; In line

AFNetworking 2.0 add headers to GET request

邮差的信 提交于 2019-12-28 07:49:07
问题 I've just started using AFNetworking 2.0 and I was wondering how I put in headers into a HTTP Get request. The documentation sets up a GET like this: AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSDictionary *parameters = @{@"foo": @"bar"}; [manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@", responseObject); } failure:^(AFHTTPRequestOperation

AFNetworking 2.0 add headers to GET request

霸气de小男生 提交于 2019-12-28 07:49:03
问题 I've just started using AFNetworking 2.0 and I was wondering how I put in headers into a HTTP Get request. The documentation sets up a GET like this: AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSDictionary *parameters = @{@"foo": @"bar"}; [manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@", responseObject); } failure:^(AFHTTPRequestOperation

AFNetworking2 send parameter as query string in POST request?

点点圈 提交于 2019-12-25 06:40:02
问题 I need to send query string in URL as well as JSON in body while making POST request.To send query string in url i override HTTPMethodsEncodingParametersInURI property as suggested in this thread on SO like AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:fullUrl]]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; manager.responseSerializer = [AFJSONResponseSerializer serializer]; manager.requestSerializer

Return data after AFNetworking is done

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 06:35:49
问题 I got a async problem with my code. I got all of my webrequests in 1 class. One of my requests needs to return an NSMutableArray that another class needs to use. My webRequest code is here: - (NSMutableArray*) getTournamentsInClub:(NSString *)clubGUID withDelegateViewController:(UIViewController *)viewController { AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSMutableArray *responseArray = [[[NSMutableArray alloc] init] autorelease]; NSString *URL = [

UIProgressView on UITableViewCell

坚强是说给别人听的谎言 提交于 2019-12-25 04:29:13
问题 I am using AFNetworking to download files from my server. It works fine. But I have one issue: My ProgressView updates wrong cell(UI, not data) when I scroll up or down. Here is my code: My Cell: AFHTTPRequestOperation *operation; @property (weak, nonatomic) IBOutlet DACircularProgressView *daProgressView; - (IBAction)pressDown:(id)sender { AFAPIEngineer *apiEngineer = [[AFAPIEngineer alloc] initWithBaseURL:[NSURL URLWithString:AF_API_HOST]]; operation = [apiEngineer downloadFile:

How to set the HTTP body for a request using AFNetworking?

落花浮王杯 提交于 2019-12-25 02:28:36
问题 In the early versions of AFNetworking if I had to make my own custom client then I would simply inherit from AFHTTPClient and create my methods. In AFNetworking 2.0 I believe I need to inherit from AFHTTPSessionManager. @interface MyCustomClient : AFHTTPSessionManager { } In my situation I need to send in request as soap. This means that HTTP Body will be soap and HTTP HEADERS will be text/xml. Let's say I have a variable which contains the entire soap body I need to send to the server.