How take a picture from camera of iPhone - iOS 7

40 views Asked by At

my program always an error of threads. error that appears at compile time http://imgur.com/6rGkwKd

1. My .h

import

@interface PerfilViewController : UIViewController

    <UIImagePickerControllerDelegate,UINavigationControllerDelegate>

    @property (weak, nonatomic) IBOutlet UIImageView *fotoPerfil;
    @property (weak, nonatomic) IBOutlet UIButton *botaoSalvarFoto;
    @property (nonatomic) UIImagePickerController *pegarFoto;

    -(IBAction)salvarFoto:(UIButton *)sender;

@end

2. My .m

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    _pegarFoto = [[UIImagePickerController alloc]init];
    _pegarFoto.delegate = self;
    _pegarFoto.sourceType =  UIImagePickerControllerSourceTypeCamera;

}

-(IBAction)salvarFoto:(UIButton *)sender {
    [self presentViewController:_pegarFoto animated:YES completion:nil];
}

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {

    _fotoPerfil.image = img;
    [[picker parentViewController] dismissViewControllerAnimated:YES completion:nil];
}
0

There are 0 answers