afnetworking

AFNetworking — get redirect URL

被刻印的时光 ゝ 提交于 2019-12-07 13:13:32
问题 Use a AFNetworking against a REST API. POST to resources/ Server responds with 303 -> see resources/3928.json The the server is giving information here: the id 3928 has been assigned to your resource. Is it possible to learn this URL during the POST operation? Also, I don't really need this resource. Can I avoid actually following the redirect? Another option is to use a 200 with {status:"ok",insert_id:3928} but it feels like this is not necessary 回答1: -(void)call { NSMutableDictionary

Pass response from AFHTTPRequestOperation to UIWebview

那年仲夏 提交于 2019-12-07 11:05:27
问题 My code is making two requests to the server. One into the uiwebview directly and one with the AFHTTPRequestOperation. I'd like to use the AFHTTPRequestOperation and just pass the response into my uiwebview. What is the correct syntax for passing the response into the uiwebview and not loading it again? How do I do that without calling twice from the server? I still want to be able to test the success or failure of the load request and also send username and password to connect to the url. -

Does AFNetworking cache images load automatically or do we have to do it manually?

你说的曾经没有我的故事 提交于 2019-12-07 10:46:45
问题 I'm using AFNetworking to load images from JSON feed. In here, first time when user opens the app, images load from the internet. It's fine. But when user go back and come again from another view, while using the app, images should load from the cache, not from the internet. How can I do that? - (void)loadDetailData { detailPost = nil; NSString *detailUrl = [NSString stringWithFormat:@"%@", self.Details.firsturl]; AFHTTPRequestOperationManager *detailManager = [AFHTTPRequestOperationManager

AFNetworking. Check download progress for all operation queue

丶灬走出姿态 提交于 2019-12-07 10:31:28
问题 I have an iOS application made with AFNetworking. I have a singleton custom httpclient subclass and i use it to consume my api and download binary files from server. I need to dowload about 100 files. Is it safe to iterate trough my url array and create one AFHTTPRequestionOperation for each url? My code is this: NSMutableURLRequest* rq = [[MIHTTPClient sharedInstance] requestWithMethod:@"GET" path:@"...." parameters:nil]; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]

Why do some dictionary keys have quotes and others don't when printing from debugger?

回眸只為那壹抹淺笑 提交于 2019-12-07 08:25:40
问题 So I am currently sending back from my server a JSON object. If I do a print of the responseObject in XCode, I get the following: Printing description of responseObject: { order = 3; "picture_bucket_name" = test; "picture_creation_date" = "2013-01-06T21:49:54.546Z"; "picture_identifier" = 61; "picture_url_with_bucket" = "test/pictures/sop/steps/test_default_320_320.png"; "sub_order" = 0; } Why is the Order key not in " "? This is the only key with a Number that I have to convert from NSString

Send data to server whenever internet connection is available iOS

北战南征 提交于 2019-12-07 07:14:48
问题 I am developing an iOS app, What i want to do is, whenever user turned on/off his internet from setting app, i want to set some notification to device. In short, i want to send some data (stored in NSUserDefaults) to server whenever internet connection is available(assuming internet connection appears after 2 3 days)....possible? Please help and thanks in advance. 回答1: Try this Apple example: https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html If you want

How to Set requestSerializer in Alamofire

安稳与你 提交于 2019-12-07 06:13:39
问题 I am currently working on a project in swift . I used Alamofire for REST API but to make it work i need to pass a parameter in requestSerializer In AFNETWORKING AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; But i can't find anything for Alamofire . I'm new to swift please help me out. 回答1: You can pass pass JSON data as encoding parameters, Encoding in Alamofire is equivalent to

Can AFNetworking handle a queue of requests?

筅森魡賤 提交于 2019-12-07 05:45:15
问题 My example on iOS 6: 10 Multi-Part requests need to be sent (in order) to the server. (so the request forms a queue) progress should be shown. if one request fails all following should fail a request queue should be cancellable Can AFNetworking help me with this? Or should I try to build something with NSOperations and run the loops myself? If I need to pass context data between theses requests for example a transaction id produced by the first request. Are there any considerations about

Sending AVAudioRecorder to server iOS

喜夏-厌秋 提交于 2019-12-07 05:40:02
问题 I am trying for the past few days to upload a locally saved sounde record to a server (which handels it with a php file and saves it to the server). the problem is that I can't find a way to do that. While recording the sound (AVAudioRecorder) it saves at a "NSTemporaryDirectory()": NSURL *temporaryRecFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"VoiceFile"]]]; Now, everywhere I checked the answer was to use ASIHTTPRequest.

AFNetworking error 53 during attempted background fetch

◇◆丶佛笑我妖孽 提交于 2019-12-07 02:59:24
问题 While updating my application to support Background App Refresh I ran into problem with AFNetworking. I am getting NSPOSIXErrorDomain Code=53 "Software caused connection abort" . The problem seems to occur in iOS 12, where the background connection gets terminated. AFNetworking 2.6.3 is used to make the fetch. AppDelegate.m : - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [OrdersService performFetch];