I'm trying to use the Dropbox iOS sdk to upload a small video file. I've had success with images, but the video upload seems to be failing. My code to upload the video is as follows
NSString *pathToMovie = [[self applicationDocumentsDirectory].path
stringByAppendingPathComponent:@"Movie.m4v"];
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:pathToMovie];
if (fileExists) {
NSLog(@"File Exsits");
//open the already downloaded file
}
if (!fileExists) {
NSLog(@"File does not Exsit");
//download and then open
}
[self.restClient
uploadFile:[NSString stringWithFormat:@"%@.m4v", [self randomStringWithLength:6]]
toPath:@"/YourFolder" fromPath:pathToMovie];
I'm checking first just to make sure the file exists and then uploading. I'm getting this error
[WARNING] DropboxSDK: error making request to /1/files_put/sandbox/YourFolder/5iG8y0.m4v -
(-1005) Error Domain=NSURLErrorDomain Code=-1005 "The operation couldn’t be completed. (NSURLErrorDomain error -1005.)"
UserInfo=0x17007c800
{sourcePath=/var/mobile/Containers/Data/Application/CC02A2FC-7B5D-435C-9F81-8A678FF61146/Documents/Movie.m4v, destinationPath=/YourFolder/5iG8y0.m4v}
I'm not really sure where the error is coming from ... again I was able to upload an image, and I tested with a very small video to make sure it was not a file size issue. I'm stumped.
Just as a note, this is not happening on the simulator, it's happening on the device, so resetting the simulator will not solve the problem