afnetworking-2

Get NSData straight from AFNetworking, rather than letting it convert to UIImage

隐身守侯 提交于 2019-12-23 08:07:14
问题 Is there a flag that would let me get NSData, rather than let AFNetworking convert my responseData into the corresponding data type(UIImage, NSString)? 回答1: The AFHTTPResponseSerializer will return the raw NSData : AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer = [AFHTTPResponseSerializer serializer]; [manager GET:... parameters:... success:^(AFHTTPRequestOperation *operation, NSData *responseObject) {} failure:...]; 回答2:

Send a bunch of requests one-by-one [closed]

偶尔善良 提交于 2019-12-23 06:00:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I need to send 100 network requests to my server one-by-one and get notified when the 100th is done. I'm using AFNetworking and was thinking about a solution of this problem. Can anyone recommend me something? 回答1: A couple of thoughts: If really just going to run each request serially (i.e. one after another),

How to do Access Token Request in Fitbit API Integration - iOS?

廉价感情. 提交于 2019-12-23 05:48:09
问题 I did OAuth2 by using OAuth2 - https://github.com/trongdth/OAuth2-for-iOS , I successfully logged in and got response { "kOAuth_AccessToken" = "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIzODY2NzEsInNjb3BlcyI6Indsb2Mgd3BybyB3bnV0IHdzbGUgd3NldCB3d2VpIHdociB3YWN0IHdzb2MiLCJzdWIiOiIzRFJQQzYiLCJhdWQiOiIyMjlROVEiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJpYXQiOjE0NDIzODMwNzF9.5vTYvUAuvMflnOw_7cc1nZoighhtUx4RU26-Q7SewzQ"; "kOAuth_AuthorizeURL" = "https://www.fitbit.com/oauth2/authorize"; "kOAuth

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

南笙酒味 提交于 2019-12-23 03:34:15
问题 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. 回答1: 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

AFNetworking send array in JSON parameters of GET request

风格不统一 提交于 2019-12-23 01:53:01
问题 I am sending array as a parameter in AFNetworking GET Request. My code is as follows: - (void)getProductSearchResult:(NSString *)locale andSearchDict:(NSDictionary *)dictSearch{ NSString *strURL = [NSString stringWithFormat:@"%@/%@/search?%@",BASEURL,locale,APIFORMAT]; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; [manager GET:strURL parameters:dictSearch success:^(AFHTTPRequestOperation

How manipulate Block Objective C in AFNetworking?

半城伤御伤魂 提交于 2019-12-22 18:36:56
问题 What I do is this: My class1 (called a method, and expects llamda) -> class2 (also called a method and waiting for a call) -> class3 (recently this class queries the JBoss server AFNetworking) . And use the method AFNetworking: - (AFHTTPRequestOperation *) POST: (NSString *) URLString parameters: (NSDictionary *) parameters constructingBodyWithBlock: (void (^) (id <AFMultipartFormData> FormData)) block success: (void (^) (* AFHTTPRequestOperation operation, responseObject id)) success failure

Swift - Why init(coder) is required in AFHTTPSessionManager?

吃可爱长大的小学妹 提交于 2019-12-22 18:08:32
问题 I'm not very experienced in iOS development. While making subclass of AFHTTPSessionManager XCode suggested me to include required init(coder) : import UIKit let _sharedAPIManager = APIManager(baseURL: NSURL(string: API_URL)!) class APIManager: AFHTTPSessionManager { /** * Singleton service * (https://github.com/hpique/SwiftSingleton) */ class var sharedInstance : APIManager { return _sharedAPIManager } init(baseURL url: NSURL!) { super.init(baseURL: url, sessionConfiguration: nil) self

Link follows when using UIWebView+AFNetworking

半世苍凉 提交于 2019-12-22 08:59:31
问题 I'm trying out AFNetworking 2.0+'s new UIKit+AFNetworking extension for UIWebView , loadRequest:progress:success:failure: . So far so good, but after the initial request is made, additional requests caused by user interaction falls back to the built-in loadRequest: of plain UIWebView . I'd much prefer that all requests went through the AFNetworking improved one. Preliminary, I'm thinking I should override as much as possible by returning NO in shouldStartLoadWithRequest and call loadRequest

com.apple.NSURLSession-work EXC_BAD_ACCESS Crash debugging

断了今生、忘了曾经 提交于 2019-12-22 06:48:02
问题 I'm seeing the following crash report, but it's not reproducible. How would I go about debugging it? Is this an AFNetworking issue? I'm using version 2.4.1. Crashed: com.apple.NSURLSession-work EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000000 Thread : Crashed: com.apple.NSURLSession-work 0 CoreFoundation 0x0000000184aad978 CFDictionaryGetValue + 56 1 Foundation 0x0000000185aa9300 _NSSetLongLongValueAndNotify + 72 2 Foundation 0x0000000185aa9300 _NSSetLongLongValueAndNotify + 72 3

AFNetworkReachabilityManager says no network

社会主义新天地 提交于 2019-12-22 05:04:42
问题 I'm confused due to lack of examples, so I did this in my appDelegate's didFinishLaunching: [[AFNetworkReachabilityManager sharedManager] startMonitoring]; bool isThere = [[AFNetworkReachabilityManager sharedManager] isReachable]; And that always returns false, in spite of the network being there and working. Two questions: 1) if I'm not looking for changes in status, do I need startMonitoring? 2) is there anything you need to do before reading isReachable? Do you need to wait? 回答1: I know it