Will this correspond or is it impossible to write?
NSData * pdfData = [[NSData alloc] initWithData:[PDFImageConverter convertImageToPDF: [image image]]]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString * filename = sharedManager.localFileName; //file name already exists NSString *pdfPath = [documentsDirectory stringByAppendingPathComponent:filename]; [pdfData writeToFile:pdfPath atomically:YES]; [pdfData release];
It will be overwritten if the recording is successful. Please note that if atomic dialing is set to YES, the source file will not be damaged if the recording fails. If atomically set to NO, it will be.
If you want to check if a file exists or not, and want to delete it before saving another PDF file, the following is the code
BOOL success = [FileManager fileExistsAtPath:zipPath]; if(success){ [FileManager removeItemAtPath:zipPath error:&error]; }
. API- , . ,
[[PHAssetResourceManager defaultManager] writeDataForAssetResource:toFile:options:completionHandler:];
, API API.