I am writing a little video-editing app on iOS. I followed the most rated answer in this question to use AVAssetwriter, but the writing failed in the end. When I got into the complete callback in
[videoWriter finishWritingWithCompletionHandler:^(){}];
I got this error from the videoWriter.error every time.
[0] (null) "NSUnderlyingError" : domain: "NSOSStatusErrorDomain" - code: 18446744073709539204
[1] (null) "NSLocalizedRecoverySuggestion" : "Try saving again."
[2] (null) "NSLocalizedDescription" : "Cannot Save"
The URL I tried to save the image is built by
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [paths objectAtIndex:0];
NSString *filename = @"processedVideo.mp4";
NSString *filenameFull = [documentsDir stringByAppendingPathComponent:filename];
NSURL *videoOutURL = [NSURL fileURLWithPath:filenameFull];
So it is like
file:///var/mobile/Containers/Data/Application/FA2BF494-9093-4034-8E6F-0FC177C9F2E3/Documents/processedVideo.mp4
Any suggestions on what did I get wrong?