title: UIIMagePickerController dismissViewControllerAnimated:completion: not working
body: <p>I'm trying to pick an image from UIImagePickerController and then set it inline inside UITextView. The code below is pretty straightforward. When i tap "act" button, it opens up UIImagePickerController and once it's done, the delegate method <code>didFinishPickingMediaWithInfo</code> gets triggered.</p>
  
  <pre><code>- (IBAction)act:(id)sender{
      UIImagePickerController *picker = [[UIImagePickerController alloc] init];
      picker.delegate = self;
      picker.allowsEditing = YES;
      picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
  
      [self presentViewController:picker animated:YES completion:NULL];
  }
  - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
      UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
      if(!self.imageView){
          self.imageView = [[UIImageView alloc] initWithImage:chosenImage];
          [self.imageView setContentMode:UIViewContentModeScaleAspectFit];
          [self.imageView setFrame:CGRectMake(10.0, 10.0, 100.0f, 100.0f)];
          [self.content addSubview:self.imageView];
          UIBezierPath *exclusionPath = [UIBezierPath bezierPathWithRect:CGRectMake(0.0,0.0,120.0f,110.0f)];
          self.content.textContainer.exclusionPaths = @[exclusionPath];
  
      } else {
          [self.imageView setImage:chosenImage];
      }
      [picker dismissViewControllerAnimated:YES completion:nil];
  }
  </code></pre>
  
  <p>Here's the problem: when i try to dismiss UIImagePickerViewController using <code>dismissViewController</code>, it is just ignored. However, it works fine without the two lines where i'm setting the exclusionPaths. Also, this only happens when there's already text in the UITextView. If there's no text, I can do this as many times as I want and dismissViewController works fine. I've stepped through the code and the code actually does pass through the <code>[picker dismissViewControllerAnimated: completion:</code> line. Also <code>picker</code> at that point is indeed an instance of UIImagePickerController. Anyone have idea what is going on?</p>
  
  <p>[UPDATE] I've actually trimmed down the code to the following:</p>
  
  <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
      UIBezierPath *exclusionPath = [UIBezierPath bezierPathWithRect:CGRectMake(0.0,0.0,120.0f,110.0f)];
      self.content.textContainer.exclusionPaths = @[exclusionPath];
      [picker dismissViewControllerAnimated:YES completion:nil];
  }
  </code></pre>
  
  <p>Basically I don't even set the imageView anymore. It's just that when I try to set the exclusionPaths of a UITextView--<code>self.content</code>--the <code>dismissViewControllerAnimated:completion:</code> doesn't work. There is no error in the console.</p>