将视频上传到Dropbox而不进行压缩

时间:2014-04-12 19:50:41

标签: ios dropbox photolibrary

我已成功将照片从照片库上传到Dropbox,视频以压缩格式上传,我希望按原样上传。我将如何在这个方法或新方法中解决这个问题?这是我的方法:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
    int i;

    // NSString *filename = [NSString stringWithFormat:@"%d.mov", i+1];
    //  NSString *file = [NSTemporaryDirectory() stringByAppendingPathComponent:filename];

    NSString *moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
    if(picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
        UISaveVideoAtPathToSavedPhotosAlbum(moviePath, self, @selector(asset:didFinishSavingWithError:contextInfo:), nil);
    }

    //NSString *file = [NSTemporaryDirectory() stringByAppendingPathComponent:moviePath];

    //commented out for now
    //NSString *destDir = @"/";
    // [self.restClient uploadFile:@"itWorked.mov" toPath:destDir withParentRev:nil fromPath:moviePath];
    //[self dismissViewControllerAnimated:YES completion:NULL];




    //new core code

    NSString *text = @"Hello world.";
    NSString *filename = @"itWorked.mov";
    NSString *localDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
    NSString *localPath = [localDir stringByAppendingPathComponent:filename];
    [text writeToFile:localPath atomically:YES encoding:NSUTF8StringEncoding error:nil];

    // Upload file to Dropbox
    NSString *destDir = @"/";
    [self.restClient uploadFile:filename toPath:destDir withParentRev:nil fromPath:moviePath];
    [self dismissViewControllerAnimated:YES completion:NULL];



}

0 个答案:

没有答案