I record a video in my app and write it it to the temp directory to allow the user to share it through UIActivityViewController. The video can successfully be played back in
I have the same error. What happens, actually - every app run the path to the file is not the same but I don't remember why I save not just the name of the file - but the whole path. Reasonable when I try to read it - I'll get nothing. Example - if I save the file each app run:
/var/mobile/Containers/Data/Application/1265C296-F2B1-44D6-AD3D-6F2DD59557D3/Documents/what.jpeg
/var/mobile/Containers/Data/Application/B2B53592-B327-48E9-BF70-BE2826022271/Documents/what.jpeg
/var/mobile/Containers/Data/Application/2505B73F-27EF-4B5C-8D21-EB49A45ABE99/Documents/what.jpeg
Right practice - use Document folder path from FileManager
, you can found more info here
+ (NSURL *)getDocumentsDirectoryPath {
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]lastObject];
}