afnetworking

AFNetworking multiple files upload

穿精又带淫゛_ 提交于 2019-12-18 04:44:09
问题 I want to upload some images into the server,so I use AFNetWork to post the files. The code is here: UIImage *image1 = [UIImage imageNamed:@"about_app"]; UIImage *image2 = [UIImage imageNamed:@"alter"]; NSArray *array = @[image1,image2]; __block int i = 0; NSMutableURLRequest *request = [[AFNetWorkSingleton shareInstance] multipartFormRequestWithMethod:@"POST" path:@"Mindex/getimg" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData>formData){ for(UIImage *eachImage in array) {

AFNetworking with request error code 999

我的梦境 提交于 2019-12-18 04:39:30
问题 I'm new to objective-c and i'm having a hard time with a AFNetworking. So the thing is that i want to make a simple POST request to a server who will send me back a salt. I'v make a simple app, in order to test my request but i don't understand why i'm getting the error code 999. Here a sample of my code. + (void)simpleRequest; { NSURL *mailserver = [NSURL URLWithString:@"https://localhost:4443/"]; AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc]initWithBaseURL:mailserver];

how to unit testing AFNetworking request

假如想象 提交于 2019-12-18 04:09:32
问题 i am making a GET request to retrieve JSON data with AFNetworking as this code below : NSURL *url = [NSURL URLWithString:K_THINKERBELL_SERVER_URL]; AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url]; Account *ac = [[Account alloc]init]; NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET" path:[NSString stringWithFormat:@"/user/%@/event/%@",ac.uid,eventID] parameters:nil]; AFHTTPRequestOperation *operation = [httpClient HTTPRequestOperationWithRequest:request

How to use Progress parameter in AFNetworking 2.0

依然范特西╮ 提交于 2019-12-18 04:03:36
问题 I am trying to use AFNetworking 2.0 with NSURLSession. I am using the method - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL progress:(NSProgress * __autoreleasing *)progress completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler; How am I supposed to use the progress parameter. The method is a non blocking method. Hence I will have to listen to the ' progress ' to get the updates. But the

How do I set the data for a “PUT” request with AFNetworking?

那年仲夏 提交于 2019-12-18 03:47:19
问题 I have started to use AFNetworking and it works well when it gets to making simple "GET"-request. However now I am trying to do a "POST"-request. I use the code below to do the "GET" request. When looking at the puthPath of AFHTTPClient there is no way to set the data to use for the body. My guess is that there is another way of fixing this. I have been looking at the AFHTTPOperation as a way of fixing this. However I am not getting this to work. The problem is that I do not know how to use

AFNetworking not resuming download

社会主义新天地 提交于 2019-12-18 03:45:28
问题 I am using AFNetworking to download large file into my iPad app. An instance of AFHTTPRequestOperation is used to download this file. Below is the code for reference - //request is the NSRequest object for the file getting downloaded AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) { }]; //here path variable is the location where

AFNetworking not resuming download

旧时模样 提交于 2019-12-18 03:45:13
问题 I am using AFNetworking to download large file into my iPad app. An instance of AFHTTPRequestOperation is used to download this file. Below is the code for reference - //request is the NSRequest object for the file getting downloaded AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) { }]; //here path variable is the location where

Does AFNetworking 2.0 support iOS 6.0?

早过忘川 提交于 2019-12-18 03:32:34
问题 AFNetworking 2.0 was announced last week. But I find different requirements for AFNetworking 2.0. README.md tells it requires either iOS 7.0 and above, while AFNetworking 2.0 Migration Guide tells it requires either iOS 6.0 and above. Dose AFNetworking 2.0 support iOS 6.0? 回答1: Accoding to the CocoaPods podspec, you can simply use AFN 2.0 but not include the NSURLSession related files. For example if you use CocoaPods (if you don't, you should really consider doing it, it's awesome!), simply

AFNetworking速成教程

馋奶兔 提交于 2019-12-18 01:23:43
转:http://palmsky.net/?p=4138 本文是由 iOS Tutorial 小组成员 Scott Sherwood 撰写,他是一个基于位置 动态加载( Dynamically Loaded )的 软件公司(专业的混合定位)的共同创办人。 网络 — 你的程序离开了它就不能生存下去!苹果的Foundation framework中的NSURLConnection又非常难以理解, 不过这里有一个可以使用的替代品: AFNetworking . AFNetworking 非常受开发者欢迎 – 它赢得了我们读者的青睐:2012年最佳的iOS Library奖( 2012 Best iOS Library Award .) 所以现在我就写这篇文章来向你介绍如何在程序中有效的使用它。 AFNetworking 包括了所有你需要与在线资源交互的内容,从web services到文件下载。当你的程序在下载一个大文件期间,AFNetworking还能确保你的UI是可以响应的。 本文将介绍AFNetworking框架主要的组成部分。一路上,你将使用 World Weather Online 提供的咨询(Feeds)来创建一个天气(Weather)程序。刚开始使用的天气数据是静态的,不过在学完本文内容之后,程序将连接到实时的天气咨询。 今日预计

Replacement for AFJSONRequestOperation in AFNetworking 2.x

南笙酒味 提交于 2019-12-17 23:27:35
问题 I am making a basic iPhone app with HTML Requests, by following this tutorial. The tutorial has me using AFJSONRequestOperation in AFNetworking. The trouble is, I'm using AFNetworking version 2, which no longer has AFJSONRequestOperation. So, of course, this code (from about half-way down the tutorial, under the heading " Querying the iTunes Store Search API ") doesn't compile: NSURL *url = [[NSURL alloc] initWithString: @"http://itunes.apple.com/search?term=harry&country=us&entity=movie"];