Usando Parse.com para cargar un video

Soy nuevo en analizar y estoy tratando de save y upload un video a la nube. Este es el código que estoy usando, pero sigue recibiendo un error cuando se llama a doneButtonAction. Creo que el problema es cuando el video se guarda como un file, pero no tengo idea de cómo arreglarlo. Gracias de antemano –

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL]; NSLog(@"%@", videoURL); if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (self.moviePath)) { UISaveVideoAtPathToSavedPhotosAlbum (self.moviePath, nil, nil, nil); } [self shouldUploadVideo]; [self doneButtonAction]; } - (void)shouldUploadVideo { //Capturamos el NSUserdefault para grabar el evento NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *loadstring = [defaults objectForKey:@"Video"]; NSLog(@"Working at first line"); NSData *videoData = [NSData dataWithContentsOfURL:self.videoURL]; NSLog(@"Working at second line"); PFFile *videoFile = [PFFile fileWithData:videoData]; NSLog(@"Working at third line"); [self.videoFile saveInBackground]; NSLog(@"Working at last line"); } - (void)doneButtonAction { // Make sure there was no errors creating the image files if (!self.videoFile) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Couldn't save your photo" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Dismiss",nil]; [alert show]; return; } // Create a Photo object PFObject *video = [PFObject objectWithClassName:kPAPPhotoClassKey];  forKey:kPAPPhotoUserKey]; ; // Request a background execution task to allow us to finish uploading // the photo even if the app is sent to the background self.photoPostBackgroundTaskId = [[UIApplication shanetworkingApplication] beginBackgroundTaskWithExpirationHandler:^{ [[UIApplication shanetworkingApplication] endBackgroundTask:self.photoPostBackgroundTaskId]; }]; // Save the Photo PFObject  setAttributesForPhoto:video likers:[NSArray array] commenters:[NSArray array] likedByCurrentUser:NO]; // Send a notification. The main timeline will refresh itself when caught [[NSNotificationCenter defaultCenter] postNotificationName:PAPTabBarControllerDidFinishEditingPhotoNotification object:video]; } else { NSLog(@"Photo failed to save: %@", error); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Couldn't post your photo" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Dismiss",nil]; [alert show]; } // If we are currently in the background, suspend the app, otherwise // cancel request for background processing. [[UIApplication shanetworkingApplication] endBackgroundTask:self.photoPostBackgroundTaskId]; }]; // Dismiss this screen [self.parentViewController dismissViewControllerAnimated:YES completion:nil]; } 

Dentro

 - (void)shouldUploadVideo { 

tienes:

 PFFile *videoFile = [PFFile fileWithData:videoData]; NSLog(@"Working at third line"); [self.videoFile saveInBackground]; NSLog(@"Working at last line"); 

Está intentando cargar self.videoFile en segundo plano, no videofile .

Esto significa que videoFile no carga el PFFile en segundo plano.

Cambio

 PFFile *videoFile = [PFFile fileWithData:videoData]; 

a

 self.videoFile = [PFFile fileWithData:videoData];