AFNetworking 2.0 and use cache only when offline
You just need to subclass the AFHTTPSessionManager
and check if the client is offline. Then you can change the cache policy or force the app to use cached data.
NSURLRequest not caching on disk using AFNetworking
I think the functionality you are wanting here is going to require using core data or writing your own caching using NSFileManager. Figure out the best approach for your app. There is a pretty cool article about NSFileManager by Mattt Thompson here
AFNetworking 2.0 queue request when device is offline with setReachabilityStatusChangeBlock does nothing
You need to call startMonitoring, before you call setReachabilityStatusChangeBlock
[manager.reachabilityManager startMonitoring];
If you are using AFNetworking 2.0, I suggest following:
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
DLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));
switch (status) {
case AFNetworkReachabilityStatusReachableViaWWAN:
case AFNetworkReachabilityStatusReachableViaWiFi:
[operationQueue setSuspended:NO];
NSLog(@"WIFI");
break;
case AFNetworkReachabilityStatusNotReachable:
default:
[operationQueue setSuspended:YES];
NSLog(@"offline, baby");
break;
}
}];
Pre-cache Images for AFNetworking's UIImageView category
Please, please don't do this.
Trust me when I say that this almost certainly unnecessary.
In fact, it will likely have the opposite of the desired effect, due to the increased pressure of downloading images that will probably never be viewed.
The cache is private for a very good reason--it's just there to speed up subsequent requests on scroll views. Just have the table view download the images as requested, and you should be just fine. If anything, you can optimize the size of the images that you are downloading (ensure correct image dimensions; compress intelligently).
Related Topics
Swift: Obtain and Save the Updated Scnnode Over Time Using Projectpoint in Scenekit
How to Update Particular Value of Child in Firebase Db
Swift: Sort Array by Sort Descriptors
Drag Uibutton Without It Shifting to Center [Swift 3]
Firebase Connection Manager Should Return Only One Result
How to Make Uiscrollview Zoom in Only One Direction When Using Auto Layout
Updating the Status Bar Style Between View Controllers
How to Make Watchkit Extension App and My iPhone App Share the Same Icloud Databases
iOS Swift App with More Photos: Performance and Storage Suggestions
How to Pass a Swift Object to JavaScript (Wkwebview/Swift)
Why Swift Use a Struct as Dictionary Key Instead of a String Here
Update Storyboard Constraint Using Code
How to Properly Handle a Nil Uiapplication.Sharedapplication().Keywindow
Calculate New Coordinates with Starting Position and Distance
Operation Went Isfinished=Yes Without Being Started by the Queue It Is In
Remove Separator Line of Single Row in Eureka
Save Struct in Class to Nsuserdefaults Using Swift
Sync Data Between Two Viewcontrollers to Avoid Creating Same Observer Again