afnetworking

How to check whether host(server) is available or not in iOS with AFNetworking

萝らか妹 提交于 2019-12-09 04:39:28
I am using AFNetworking in my App for communicating with server. How can i check whether my host(server) is available or not, i should check this before i am sending a request to server. Using AFNetworking 2.0 that provide method like below you can check instead of using Reachability class. - (void)viewDidLoad { [super viewDidLoad]; [[AFNetworkReachabilityManager sharedManager] startMonitoring]; } After set start-monitoring in to viewDidLoad you can check any where in to class using Bellow Method. if ([[AFNetworkReachabilityManager sharedManager] isReachable]) { NSLog(@"IS REACHABILE"); } else

Asynchronous downloading in UICollectionView error with AFNetworking

坚强是说给别人听的谎言 提交于 2019-12-09 04:37:30
Hi I'm creating Uicollection view with list ofcatalogs, While tapping on cell the PDF have to download, Its working in one view perfectly but in another view gives the error * thread #1: tid = 0x4b2ce, 0x000000018d14f9b8 CoreFoundation`CFURLCopyScheme + 56, queue = 'com.apple.NSURLSession-work', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x000000018d14f9b8 CoreFoundation`CFURLCopyScheme + 56 frame #1: 0x000000018cdab96c CFNetwork`_urlIsHTTPish + 16 frame #2: 0x000000018cdc76b0 CFNetwork`URLRequest::addOverridingSessionAttributes(_CFURLSessionConfiguration*) + 288 frame #3:

Uploading to Amazon-S3 via AFNetworking

安稳与你 提交于 2019-12-09 01:09:09
问题 I'm having difficulty uploading files to S3 via AFNetworking. When I attempt to upload, I get callbacks indicating a small percentage of the file is uploaded, then the callbacks cease, and one or two minutes later I get a timeout message. I'm using AFAmazonS3Client but it seems like a pretty straight forward subclass of AFHTTPClient so it seems unlikely the problem lies there. Since I'm new to both AFNetworking and S3, I'm pretty sure the problem is typing this message :) I've downloaded the

is it possible to install AFNetworking 2.0 with Restkit

核能气质少年 提交于 2019-12-08 15:01:18
问题 I got an news app which fetches news online in XML format in stores it locally in the sqlite dbase.. which is perfect case for restkit. However, I would like to also fetch xml data manually sometimes (ie and not want to store it in the dbase).. in other words i would like to request it directly with AFNetworking. I like how in AFNetworking 2.0 it does the parsing of xml automatically, and so I want to use that feature. However, Restkit 2.0 is linked to AFNetworking 1.3.. and so If I add this

Swift Custom Response Serializer is returning images at random

安稳与你 提交于 2019-12-08 13:20:37
I am currently using Alamofire to Fetch Json data/url-images from a Server. I also created a custom response serializer using this tutorial to convert url images into UIImages upon request. Everything works fine, and I am able to load all of the Images from the server into a UIImageView. The user can then swipe from left to right in order to View each image like a Photo Gallery. The Problem I am having is that my custom response returns the images in a different order. Therefore, every image being displayed is not in the correct order it initially started in. Would anyone know how I can fix

GET request using AFNetworking and saving response

你离开我真会死。 提交于 2019-12-08 12:58:27
I am doing a simple GET request with AFNetworking AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager GET:@"http://someapi.com/hello.json" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@", responseObject); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Error: %@", error); }]; Once I have made the request I want to be able to access the responseObject from any other method in the class. I want to be able to save the responseObject so I can do something like display the output in a

AFNetworking 2.0 - How to pass response to another class on success

只愿长相守 提交于 2019-12-08 11:37:53
问题 I am wondering how can I call AFHTTPSessionManagern from different class. Currently I use this code to get the response but I am not sure how to convert this to singleton class which requires parameters and postback link. I am receiving and processing JSON code only. static NSString * const BaseURLString = @"http://www.example.com/"; NSURL *baseURL = [NSURL URLWithString:BaseURLString]; NSDictionary *parameters = @{ @"Token" : @"123456"}; AFHTTPSessionManager *manager = [[AFHTTPSessionManager

send Post request to PHP Server

烈酒焚心 提交于 2019-12-08 09:39:54
问题 I tried so send some data from two textfields with my button, once i press the button I receive an E-mail without the content of the textfields which I typed in my iOS Simulator. I can not find the problem, please help me. ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController { UITextField * firstname; UITextField *lastname; UIButton *sendPost; } @property (strong, nonatomic) IBOutlet UITextField *firstname; @property (strong, nonatomic) IBOutlet UITextField

How to add an Auth Token in every request using AFIncrementalStore?

六月ゝ 毕业季﹏ 提交于 2019-12-08 09:28:42
问题 I have an iOS + Rails 3.1 app, and I'm using AFIncrementalStore for the client-server communication. I have implemented Token Authentication on my Rails server according to this tutorial: http://matteomelani.wordpress.com/2011/10/17/authentication-for-mobile-devices/ I now want to include the &auth_token=XXXXXXXX in every request from client to server, including POST requests. How would I do that? I haven't found the solution in this related post: Using AFIncrementalStore with an Auth token

AFNetworking: How/when to prompt for username and password for BASIC Auth?

谁都会走 提交于 2019-12-08 09:01:50
问题 I'm looking for a best-practice about prompting the user for credentials. I have to code for the possibility that after the user logs in from the phone, he/she could login from another device or webpage and change the password. Since I'm doing BASIC auth, that token will now be incorrect and I need to handle it appropriately. I've started a new project with AFNetworking. I have subclassed AFHTTPClient and I've overridden the HTTPRequestOperationWithRequest message to set a authentication