title: iOS 4.3 crashes when uploading video
body: <p>I have an iPhone app that uploads images and video to a web service using ASIHTTPRequest. Everything works great on devices running iOS 5, but crashes on 4.3 and below devices after returning from the UIImagePickerController. The video is compressed bu=y the picker, then the app crashes. Below is the code from the -(void)imagePickerController: didFinishPickingMediaWithInfo: method, and also from the method that post the video to the server and a method that captures an image from the video to use as a thumbnail. Any ideas on what's causing the crashes in 4.3?</p>
  
  <pre><code>-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
  {
  
  self.mediaType = [info objectForKey:UIImagePickerControllerMediaType];
  
   if ([self.mediaType isEqualToString:(NSString *)kUTTypeMovie])
  {
      NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
  
      // Get asset to use for orientation determination   
      AVAsset *myAsset = [AVAsset assetWithURL:videoURL];
  
      self.videoOrientation = [self UIInterfaceOrientationToString:[self orientationForTrack:myAsset]];
  
      UIImage *videoThumbnail = [self getVideoThumbnailFromAVAsset:myAsset];
      self.photoImageView.image = videoThumbnail;
  
      self.videoData = [[NSMutableData alloc]initWithContentsOfURL:videoURL];
  }
  [self dismissModalViewControllerAnimated:YES]; 
  }
  
  -(UIImage*)getVideoThumbnailFromAVAsset:(AVAsset *)myAsset {
  AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc] initWithAsset:myAsset];
  
  Float64 durationSeconds = CMTimeGetSeconds([myAsset duration]);
  CMTime midpoint = CMTimeMakeWithSeconds(durationSeconds/2.0, 600);
  NSError *error = nil;
  CMTime actualTime;
  UIImage *myImage;
  
  CGImageRef halfWayImage = [imageGenerator copyCGImageAtTime:midpoint actualTime:&amp;actualTime error:&amp;error];
  
  if (halfWayImage != NULL) {
      myImage = [UIImage imageWithCGImage:halfWayImage];
      CGImageRelease(halfWayImage);
  }
  return myImage;
  }
  
  - (void)postMessage:(id)sender {
  
  self.uploadButton.enabled = NO;
  [self.descriptionTextField resignFirstResponder];
  [self.titleTextField resignFirstResponder];
  
  NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
  NSString *sessionKey = [settings stringForKey: @"sessionKey"];
  
  // build URL for request
  NSString *baseURL;
  NSString *endPoint;
  
  // code here that creates the url component strings baseURL and endPoint
  
  NSString *fullURL = [NSString stringWithFormat:@"%@%@", baseURL, endPoint];
  NSURL *url = [NSURL URLWithString:fullURL];
  
  ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
  request.postFormat = ASIMultipartFormDataPostFormat;
  
  NSString *teamIDStr = [NSString stringWithFormat:@"%d",[self.teamID intValue]];
  
  [request setPostValue:sessionKey forKey:@"sessionKey"];
  [request setPostValue:teamIDStr forKey:@"TeamID"];   
  [request setPostValue:titleTextField.text forKey:@"lessonName"];
  [request setPostValue:descriptionTextField.text forKey:@"lessonDesc"];
  [request setPostValue:self.videoOrientation forKey:@"videoOrientation"];
  
  //create video file name
  NSDate *date1=[NSDate date];
  NSDateFormatter *formatter1 = [[NSDateFormatter alloc] init];
  [formatter1 setDateFormat:@"hhmm"];
  NSString *valuestr = [formatter1 stringFromDate:date1];
  NSString *moviename = [NSString stringWithFormat:@"video_%@.mov", valuestr];
  
  [request setData:self.videoData withFileName:moviename andContentType:@"video/quicktime" forKey:@"file1.mov"];
  
  [request setUploadProgressDelegate:self.progressBar];
  [request setShowAccurateProgress:YES];
  self.progressBar.hidden = NO;
  [request setDelegate:self];
  [request setTimeOutSeconds:600];
  [request startAsynchronous];
  
  }
  </code></pre>