#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// 设置缓存
/**
1. 内存缓存的大小
2. 沙盒缓存的大小
3. 沙盒缓存的路径(默认就在cache文件夹下面,不需要传完整的路径)
*/
NSURLCache *cache = [[NSURLCache alloc]initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:@"zhang"];
NSLog(@"%@",NSHomeDirectory());
// 把自定义的缓存对象设置成默认
[NSURLCache setSharedURLCache:cache];
return YES;
}
网络:GET 与自设缓存方法
