2

Our commercial app is crashing while testing it with Automation scripts in Instruments. We narrowed down the issue to the UIImagePickerController. But it only crashed while connected to Instruments!

To narrow down the problem we created a bare bones Tester app that does only one thing: bring up the Camera Picker then dismiss it.

The steps to reproduce are 1. click Button to bring up camera 2. Dismiss Camera by clicking Cancel 3. Repeat 40-50 times.

Running on a device there is no problem after over 100 repetitions Connecting to Instruments it crashes reliably after 40-50 repetitions.

The Tester app has a single view that has a UIButton inside view controller. When clicking the button, it presents a UIImagePickerController from the view controller, like so:

-(IBAction)buttonClicked:(id)sender
{
    imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;
    imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;

    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.showsCameraControls = TRUE;

    [self presentViewController:imagePicker animated:YES completion:^{}];

}

This is the declaration of the view controller:

@interface ViewController : UIViewController<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
{
    UIImagePickerController *imagePicker;
}

After the UIImagePickerController is launched, simply press the Cancel button to exit out of the UIImagePickerController, and the delegate method looks like this:

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [self dismissViewControllerAnimated:YES completion:^{
        NSLog(@"Cancel Picker");
    }];
}

Any help will be appreciated.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.