iOS.Lover
iOS.Lover

Reputation: 6051

UIimagePicker and application freezing !

I am trying to take a picture with camera , but after capture a picture or cancel imagePickerView , my application will be freeze without any bug report or BAD_ACCESS or crash ! jut freeze !!!! here is my code :

    -(IBAction)takePic {

    if ([UIImagePickerController isSourceTypeAvailable:CAMERASUPPROT]) {

        USImage.hidden = YES;
        ipc = [[UIImagePickerController alloc]init];

        ipc.delegate = self;
        ipc.sourceType = UIImagePickerControllerSourceTypeCamera; 
        ipc.cameraOverlayView = maskImage;
        ipc.delegate = self;
        [self.view addSubview:MaskArea];
        [self presentModalViewController:ipc animated:YES];
        TAKENPHOTO.image = nil;
        [ipc release];

  } else {

        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"Your Device Doesn't Support Camera" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [alert show];
        [alert release];
    }

}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    TAKENPHOTO.image = [info objectForKey:UIImagePickerControllerOriginalImage];
    [picker dismissModalViewControllerAnimated:YES];

}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { 

    [picker dismissModalViewControllerAnimated:YES];
}

Upvotes: 0

Views: 678

Answers (1)

Mc.Lover
Mc.Lover

Reputation: 4994

assuming [self.view addSubview:MaskArea]; it's an UIView so , I think the problem is this line , remove it then try again !

Upvotes: 1

Related Questions