title: Can't get image from UIImagePickerController
body: <p>I've checked several tutorials and from what I can tell my code is correct, but at the end I don't get the image.  I don't get any error, but the image on the screen I'm trying to set is still blank.</p>
  
  <p>Here's my header file</p>
  
  <pre><code>@interface homeViewController : UIViewController&lt;UIImagePickerControllerDelegate, UINavigationControllerDelegate&gt;
  
  @property (weak, nonatomic) IBOutlet UIImageView *avatarImage;
  @property (weak, nonatomic) IBOutlet UIButton *photoButton;
  
  @property (nonatomic, retain) UIImagePickerController *imgPicker;
  
  - (IBAction)setPhoto;
  
  @end
  </code></pre>
  
  <p>And here's the related methods</p>
  
  <pre><code>- (IBAction)setPhoto 
  {
      self.imgPicker = [[UIImagePickerController alloc] init];
      self.imgPicker.sourceType=UIImagePickerControllerSourceTypeCamera;
      self.imgPicker.delegate=self;
      self.imgPicker.allowsEditing = YES;
      self.imgPicker.showsCameraControls=YES;
  
      [self presentModalViewController:self.imgPicker animated:YES];
  }
  
  - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker 
  { 
      [picker dismissModalViewControllerAnimated:YES]; 
  }
  
  
  - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
  {
      UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
  
      self.avatarImage = [[UIImageView alloc] init];
      self.avatarImage.image = image;
      [self dismissModalViewControllerAnimated:YES];
  }
  </code></pre>
  
  <p>When I place a breakpoint here: [self dismissModalViewControllerAnimated:YES];
  I see that the image variable has a value, but the self.avatarImage has a 0x00000000</p>