//
//  ALDownloadViewController.m
//  GMAlpha
//
//  Created by Jing on 2018/12/6.
//  Copyright © 2018 Gengmei. All rights reserved.
//

#import "ALDownloadDemoViewController.h"
#import "ALDownloadManager.h"

@interface ALDownloadDemoViewController ()

@end

@implementation ALDownloadDemoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *url = @"http://phvf6wllb.bkt.clouddn.com/yangmi.obj";
    NSString *folderName = @"obj";
    NSString *documentPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:folderName];
    NSFileManager *fileManager = [NSFileManager defaultManager];
    BOOL isDirectory = YES;
    if (![fileManager fileExistsAtPath:documentPath isDirectory:&isDirectory]) {
        [fileManager createDirectoryAtPath:documentPath withIntermediateDirectories:YES attributes:nil error:nil];
    }
    [ALDownloadManager downloadTaskWithURL:url path:documentPath completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
        NSString *fileName = [fileManager displayNameAtPath:filePath.absoluteString];
        
        
    }];
}


@end
