afnetworking

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

折月煮酒 提交于 2019-12-05 16:34:29
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 manager]; [detailManager GET:detailUrl parameters:nil success:^(AFHTTPRequestOperation *operation, id

Send data to server whenever internet connection is available iOS

五迷三道 提交于 2019-12-05 14:28:24
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. Try this Apple example: https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html If you want this to work when app in background try background task If you what your app doesn't suspend in background

Sending AVAudioRecorder to server iOS

旧巷老猫 提交于 2019-12-05 11:32:45
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 . but the problem is that it is not supported in ios6. There are some other libraries for it but nothing

Error Domain=com.alamofire.error.serialization.response Code=-1011 “Request failed: internal server error (500)”

与世无争的帅哥 提交于 2019-12-05 08:17:56
I am using afnetworking in my application. To post data on server I wrote following code - (void) callLoginAPI:(NSDictionary *)dictProfile{ // 1 NSDictionary *params = @{@"username":[dictProfile valueForKey:@"name"], @"first_name":[dictProfile valueForKey:@"first_name"], @"last_name":[dictProfile valueForKey:@"last_name"], @"email":[dictProfile valueForKey:@"email"], @"dob":[dictProfile valueForKey:@"birthday"], @"gender":[dictProfile valueForKey:@"gender"], @"location":[[dictProfile valueForKey:@"location"] valueForKey:@"name"], @"timezone":[dictProfile valueForKey:@"timezone"], @"language":@

AFNetworking 2.0 : Cannot POST with JSON from IOS

﹥>﹥吖頭↗ 提交于 2019-12-05 08:01:40
Ever since upgrading my IOS code to use AFNetworking version 2.0 instead of 1.x, I cannot do an HTTP Post any more with JSON parameters. I suspect it is because my HTTP request header is not "application/json" but I have tried to do that and it still does not work. This is my test code for trying to POST by JSON: NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys: email, @"email", password, @"password", nil]; [[OTApiClient sharedInstance] POST:@"login" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"result: %@", responseObject)

AFNetworking error 53 during attempted background fetch

孤街浪徒 提交于 2019-12-05 06:36:05
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]; completionHandler(UIBackgroundFetchResultNewData); } OrdersService.m : -(void) performFetch { [

persistentStoreManagedObjectContext vs mainQueueManagedObjectContext

馋奶兔 提交于 2019-12-05 06:08:39
Good evening! So I've been having some trouble understanding what the hell is going on while saving my data in Core Data. First of all, a quick question: 1) When should I be using the persistentStoreManagedObjectContext and when should I be using the mainQueueManagedObjectContext?! Right now, I always use the persistentManagedObjectContext, but I can see that a RestKit call "getObjectsPath", the object will have the mainQueueObjectContext. Why is that?! Thanks! flashfabrixx persistentStoreManagedObjectContext could be used to populate other another NSManagedObjectContext (e.g. for a background

AFNetworking (AFHttpClient) offline mode not working with NSURLRequestReturnCacheDataDontLoad policy

自作多情 提交于 2019-12-05 05:23:16
I am using AFNetworking in my app and try to make it work in the offline mode by use the cached data if available. I expected after I set the request cache policy to NSURLRequestReturnCacheDataDontLoad, getPath:parameters:success:failure: will success with the cached data while offline. However, even if there are data in the cache (I verified by check the cache with the code), getPath will simply fail in airplane mode. There was a thread in AFNetworking github: https://github.com/AFNetworking/AFNetworking/issues/378 But seemed the issue is not addressed at all. The author of AFNetworking

Suggestions on asynchronous image loading for UITableView in iOS

情到浓时终转凉″ 提交于 2019-12-05 05:12:51
问题 I am currently loading my table with a left-sided thumbnail, title and subtitle using this code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } NSDictionary *post = [posts

-fno-objc-arc not working to disable ARC

非 Y 不嫁゛ 提交于 2019-12-05 01:42:00
I have tried the solution found in this post to disable ARC in AFNetworking files, but to no avail: Any ideas where I am failing? Obviously the simpler the answer the better. I have also read that creating static libraries may help, but this seems complicated. EDITS I have tried deleting derived data and Clean and Build and restarting Xcode. No deals :(. Also, there are no other projects in my workspace. Weird thing. I tried adding the -fno-objc-arc flag to some Facebook files and the project finally built. I guess the lesson here is that when Xcode generates these types of errors, the source