How to check if an ALAsset still exists using a URL

前端 未结 4 907
悲哀的现实
悲哀的现实 2020-12-05 11:57

I\'ve got an array containing ALAsset urls (not full ALAsset objects) So each time I start my application I want to check my array to see if it\'s still up to date...

<
4条回答
  •  攒了一身酷
    2020-12-05 12:24

    Use this method to check if file exists

    NSURL *yourFile = [[self applicationDocumentsDirectory]URLByAppendingPathComponent:@"YourFileHere.txt"];
    
    if ([[NSFileManager defaultManager]fileExistsAtPath:storeFile.path 
    isDirectory:NO]) {
    
        NSLog(@"The file DOES exist");
    
    } else {
    
        NSLog(@"The file does NOT exist");
    }   
    

提交回复
热议问题