How to check if a file exists in Documents folder?

后端 未结 7 1385
小蘑菇
小蘑菇 2020-11-29 14:53

I have an application with In-App Purchase, that when the user buy something, download one html file into the Documents folder of my app.

Now I must check if this HT

7条回答
  •  眼角桃花
    2020-11-29 15:36

    check if file exist in side the document/catchimage path :

    NSString *stringPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
    NSString *tempName = [NSString stringWithFormat:@"%@/catchimage/%@.png",stringPath,@"file name"];
    NSLog(@"%@",temName);
    if([[NSFileManager defaultManager] fileExistsAtPath:temName]){
        // ur code here
    } else {
        // ur code here** 
    }
    

提交回复
热议问题