Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderZhuXH committed Jan 10, 2020
1 parent 7155e10 commit bacef44
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions XHLaunchAd/XHLaunchAd/XHLaunchAdDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ - (void)URLSession:(NSURLSession *)session
didFinishDownloadingToURL:(NSURL *)location {
NSError *error=nil;
NSURL *toURL = [NSURL fileURLWithPath:[XHLaunchAdCache videoPathWithURL:self.url]];
[[NSFileManager defaultManager] copyItemAtURL:location toURL:toURL error:&error];

[[NSFileManager defaultManager] copyItemAtURL:location toURL:toURL error:&error];//复制到缓存目录

if(error) XHLaunchAdLog(@"error = %@",error);
dispatch_async(dispatch_get_main_queue(), ^{
if (self.completedBlock) {
Expand Down Expand Up @@ -276,9 +278,7 @@ - (void)downloadVideoAndCacheWithURL:(nonnull NSURL *)url completed:(void(^)(BOO
if(error){
if(completedBlock) completedBlock(NO);
}else{
[XHLaunchAdCache async_saveVideoAtLocation:location URL:url completed:^(BOOL result, NSURL * _Nonnull URL) {
if(completedBlock) completedBlock(result);
}];
if(completedBlock) completedBlock(YES);
}
}];
}
Expand Down

0 comments on commit bacef44

Please sign in to comment.