afnetworking

iOS开发~CocoaPods使用详细说明

两盒软妹~` 提交于 2020-01-12 09:17:05
一、概要 iOS开发时,项目中会引用许多第三方库,CocoaPods( https://github.com/CocoaPods/CocoaPods )可以用来方便的统一管理这些第三方库。 二、安装 由于网上的教程基本都大同小异,但细节之处还不是很完善,所以借机会在这里补充下: 注:要使用CocoaPods,那就要下载安装它,而下载安装CocoaPods需要Ruby环境 1、Ruby环境搭建 当前安装环境为Mac mini 10.8.5。Mac OS本身自带Ruby,但还是更新一下保险,因为我第一次安装在没有更新Ruby的情况下就失败了。 a 查看下当前ruby版本:打开终端输入 ruby -v(确实安装了,不过用这个版本接下来工作失败了,所以更新下ruby) ritekiMac-mini:PodTest lucky$ ruby -v ruby 1 .8 .7 ( 2 0 1 2- 0 2- 0 8 patchlevel 3 5 8) [universal-darwin 1 2 .0] ritekiMac-mini:PodTest lucky$ b 更新ruby 终端输入如下命令(把Ruby镜像指向taobao,避免被墙,你懂得) gem sources --remove https://rubygems.org/ gem sources -a https://ruby

AFNetworking 2.0 download multiple images with completion

本小妞迷上赌 提交于 2020-01-10 15:38:06
问题 I'm trying to figure out a way to download multiple images with AFNewtorking 2.0. I've read a lot of posts here in SO, but can't find the answer I'm looking for, hope you guys can help me. The problem is that I want to know when all of the downloads finished and if all images where downloaded. So I have an array with image URL's ant trying to do something like this. for(NSString *photoUrlString in self.photos){ NSURL *url = [NSURL URLWithString:photoUrlString]; AFHTTPRequestOperation

How To Disable AFNetworking Cache

自闭症网瘾萝莉.ら 提交于 2020-01-09 04:22:06
问题 Is it possible to disable all the cache features from AFNetworking? I am building my own custom cache system and don't want this to take up disk space too. Thanks, Ashley 回答1: Cacheing is handled application-wide by NSURLCache . If you don't set a shared cache, requests are not cached. Even with a shared NSURLCache , the default implementation on iOS does not support disk cacheing anyway. That said, unless you have a very particular reason to write your own cacheing system, I would strongly

How to wait response and parse XML done in afnetworking iOS

我的梦境 提交于 2020-01-07 09:51:33
问题 I want to wait until server reponse and parse XML done, then call another function. How can i do that? I used this code to send request to server and use NSXMLParser to parse XML response. NSURL *url1 = [NSURL URLWithString:@"linkserver"]; AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL: url1] ; NSDictionary *params1 = @{ @"a" : vd; @"b" : @"all" }; NSMutableURLRequest *afRequest = [httpClient requestWithMethod:@"GET" path:nil parameters:params1] ; AFHTTPRequestOperation

Upload image using AFnetworking did not response anything

微笑、不失礼 提交于 2020-01-06 21:08:58
问题 Here's the problem : I want to upload image immediately after finish choosing image from imagepicker. So, I put my code to upload image using afnetworking in imagepicker delegate method. But it doesn't response anything. //set the imageview to current image after choosing profilePic.image = image; //dismiss the imagepicker [picker dismissModalViewControllerAnimated:YES]; //start upload image code NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: @"steventi1901", @"username",

AFNewtorking loading images from Amazon S3

左心房为你撑大大i 提交于 2020-01-06 12:42:44
问题 We were using AFNetworking only to load images like this: [thumbnailImage setImageWithURL:_item.thumbnailUrl]; and it worked fine. But now we've pulled in the rest of the project it has stopped working. It was just showing the background color. So I tried using this and it loads the placeholder but never loads the image. UIImage* placeholder = [UIImage imageNamed:@"placeholder"]; [thumbnailImage setImageWithURL:_item.thumbnailUrl placeholderImage:placeholder]; I thought I might be able to see

Request failed: bad request (400) in “AFMultipartFormData”

守給你的承諾、 提交于 2020-01-06 03:07:09
问题 I am working with afnetworking with objective c. My parameter type is "formData". So I am using "AFMultipartFormData" Here is my code NSLog(@"enter in requestPostFormData"); AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; manager.responseSerializer = [AFJSONResponseSerializer serializer]; manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@

AFNetworking set image without extension

丶灬走出姿态 提交于 2020-01-05 23:42:12
问题 There is a method in AFNetworking that can set image conveniently: - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholderImage but if the url image have no extension(like http://static.qyer.com/album/user/330/21/QkpVQBsHaA/670), there are some problems,sometimes the image can be displayed exactly some times it is not displayed. I found a method [AFImageRequestOperation addAcceptableContentTypes:<#(NSSet *)contentTypes#>]; how should I set the contentTypes? 回答1: If you

AFJSONRequestOperation returns null response in iOS

谁都会走 提交于 2020-01-05 04:30:07
问题 I am facing 1 problem while using AFJSONRequestOperation. My API Client is as follows #import <Foundation/Foundation.h> #import "AFHTTPClient.h" #import "AFJSONRequestOperation.h" @interface MyAPIClient : AFHTTPClient + (MyAPIClient *)sharedAPIClient; @end // .m file #import "MyAPIClient.h" @implementation MyAPIClient + (MyAPIClient *)sharedAPIClient { static MyAPIClient *sharedClient = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedClient = [[MyAPIClient alloc]

Using AFNetworking to POST a file asynchronously with upload progress to Strava V3 API

左心房为你撑大大i 提交于 2020-01-04 18:15:23
问题 I would like to post an activity to Strava from iOS. Strava docs (http://strava.github.io/api/v3/uploads/#post-file) have curl example as following: EXAMPLE REQUEST $ curl -X POST https://www.strava.com/api/v3/uploads \ -F access_token=83ebeabdec09f6670863766f792ead24d61fe3f9 \ -F activity_type=ride \ -F file=@test.fit \ -F data_type=fit In this case the file test.fit is the activity to post. I am attempting to post this asynchronously using AFNetworking. I have the following test code: NSURL