afnetworking

Why Reachability Manager can not detect internet?

落花浮王杯 提交于 2020-01-04 13:11:50
问题 I am trying to learn AFNetworking. when I run following code I get there is no internet. But in another check it says it is connected to the internet and device is connected to internet through wifi. This the output: 2016-02-19 15:16:40.315 AFNetworkingSample[377:47927] There is no internet connection 2016-02-19 15:16:40.331 AFNetworkingSample[377:47927] Reachability: Reachable via WiFi Any idea why return value of connected method is false? - (void)viewDidLoad { [super viewDidLoad]; [

AFNetworking - occasionally get “unacceptable content type: application/json” on http response

六月ゝ 毕业季﹏ 提交于 2020-01-04 02:28:07
问题 I can't figure out why this message is being thrown by AFNetworking 2.0. My understanding is that application/json is the default serialization scheme, so if the server returns JSON with content-type:application/json, why would AFNetworking throw this error? Failure with messages Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: application/json" UserInfo=0x17e2ed60 {com.alamofire.serialization.response.error.response=

How can I migrate in AFNetworking 3.0?

送分小仙女□ 提交于 2020-01-04 02:22:25
问题 I am migrating in AFNetworking 3.0. I am using AFHTTPRequestOperation in AFNetworking but it was removed in recent updates. I tried all the possible solution. Basically I need to post a JSON with Header. I convert my NSDIctionary into a JSON object then add it as string. Here is the sample JSON with Header of mine RequestHeader={ "lname" : "sadhsdf", "bday" : "2003-03-13", "age" : "12", "address" : "dsfhskdjgds", "gender" : "M", "cnumber" : "12312412", "fname" : "sadhsdf", "RequestType" :

AFNetworking 2.0 API For Multi-part form upload

谁都会走 提交于 2020-01-04 02:16:12
问题 What is the AFNetworking 2.0 method for uploading a multipart form i.e. With AFHTTPSessionManager or AFHTTPRequestOperationManager Here is an example of some AFNetworking < 2.0 code: [[ASAPIClient sharedClient] enqueueHTTPRequestOperation:[[ASAPIClient sharedClient] HTTPRequestOperationWithRequest:[[ASAPIClient sharedClient] multipartFormRequestWithMethod:@"POST" path:@"/some/url" parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { if(_selectedPhoto.image) {

AFNetworking 2.0 API For Multi-part form upload

倾然丶 夕夏残阳落幕 提交于 2020-01-04 02:16:04
问题 What is the AFNetworking 2.0 method for uploading a multipart form i.e. With AFHTTPSessionManager or AFHTTPRequestOperationManager Here is an example of some AFNetworking < 2.0 code: [[ASAPIClient sharedClient] enqueueHTTPRequestOperation:[[ASAPIClient sharedClient] HTTPRequestOperationWithRequest:[[ASAPIClient sharedClient] multipartFormRequestWithMethod:@"POST" path:@"/some/url" parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { if(_selectedPhoto.image) {

Using RestKit to perform a synchronous request

雨燕双飞 提交于 2020-01-04 01:58:15
问题 - (BOOL)do_a_Restkit_request_and_return_a_boolean { [manager postObject:nil path:@"/mypath" parameters:@{@"password":password} success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) { myResult = [mappingResult firstObject] == 5; } failure:^(RKObjectRequestOperation *operation, NSError *error) { }]; return myResult; } Hello I would like to make a RestKit call like the above Synchronous so as to return myResult after the call of the Success block. 回答1: You can use an

Memory pressure issue while downloading multiple files using AFNetworking

心不动则不痛 提交于 2020-01-03 05:17:30
问题 In my application i am trying to download thousands of images (each image size with a maximum of 3mb) and 10's of videos (each video size with a maximum of 100mb) and saving it in Documents Directory. To achieve this i am using AFNetworking Here my problem is i am getting all the data successfully when i am using a slow wifi (around 4mbps) , but the same downloading if i am doing under a wifi with a speed of 100mbps the application is getting memory warning while downloading images and memory

Cocoapod 0.38.0 and AFNetworking 2.5 AF_APP_EXTENSIONS compilation error

对着背影说爱祢 提交于 2020-01-03 03:52:08
问题 My project has 9 targets : - Prod - Prod_app_extension_1 - Prod_app_extension_2 - Beta - Beta_app_extension_1 - Beta_app_extension_2 - Dev - Dev_app_extension_2 - Dev_app_extension_2 I'm using 0.38.2 cocoapod version and 2.5.4 AFNetworking. I'm trying to use AFNetworking with cocoapod but I get the AF_APP_EXTENSIONS error while compiling. After searching for the solution on the web, I understand the problem and found that defining the 'preprocessor macros' AF_APP_EXTENSIONS can fix the

Swift Custom Response Serializer is returning images at random

笑着哭i 提交于 2020-01-03 02:51:10
问题 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

AFNetworking Return value from async task iOS

南楼画角 提交于 2020-01-02 18:17:55
问题 I recently have asked about nil value from AFNetwirking GET query. Here is the question I've got an answer + (void)getRequestFromUrl:(NSString *)requestUrl withCompletion:((void (^)(NSString *result))completion { NSString * completeRequestUrl = [NSString stringWithFormat:@"%@%@", BASE_URL, requestUrl]; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager GET:completeRequestUrl parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject)