NSDocumentDirectory
is sandboxed for every iOS app. The API you are looking for is UISaveVideoAtPathToSavedPhotosAlbum.
For example:
UISaveVideoAtPathToSavedPhotosAlbum(videoPath, nil, nil, nil);
Question
I have a app which takes a movie and saves it to the apps temp folder after the video is completed i need to move it to video folder on the device.... How would this be accomplished using Default File manager ?
Source code i found.... and if i save the file in the documents directory am will i be able to access it from Video app on iPhone?
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *txtPath = [documentsDirectory stringByAppendingPathComponent:@"txtFile.txt"];
if ([fileManager fileExistsAtPath:txtPath] == NO) {
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"txtFile" ofType:@"txt"];
[fileManager copyItemAtPath:resourcePath toPath:txtPath error:&error];
}
Solution
NSDocumentDirectory
is sandboxed for every iOS app. The API you are looking for is UISaveVideoAtPathToSavedPhotosAlbum.
For example:
UISaveVideoAtPathToSavedPhotosAlbum(videoPath, nil, nil, nil);