views:

138

answers:

0

When I display a UIImagePickerController in a UIPopoverController the console outputs the following warnings:

sqlite error 8 [attempt to write a readonly database]
sqlite error 8 [attempt to write a readonly database]
sqlite error 8 [attempt to write a readonly database]
sqlite error 1 [no such column: duration]
sqlite error 1 [no such column: duration]
sqlite error 8 [attempt to write a readonly database]
sqlite error 8 [attempt to write a readonly database]
sqlite error 8 [attempt to write a readonly database]

Here is the code that displays the picker:

- (void)openImagePickerController:(id)sender {
    //TODO only open one at a time

    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    //imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.delegate = self;

    [self presentViewController:imagePicker sender:sender animated:YES modal:YES];
    [imagePicker release];
}

- (void)presentViewController:(UIViewController *)vc
                       sender:(id)sender
                     animated:(BOOL)animated
                        modal:(BOOL)modal {

    BOOL useNavController = NO;
    //if((void *)UI_USER_INTERFACE_IDIOM() != NULL &&
    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { //are we on an iPad?

        Class popoverClass = NSClassFromString(@"UIPopoverController");
        if(!popoverClass) {
            useNavController = YES;
        } else {
            if(currentPopover == nil || currentPopover.contentViewController != vc) {
                if(currentPopover != nil) {
                    [currentPopover dismissPopoverAnimated:animated];
                    [currentPopover.delegate popoverControllerDidDismissPopover:currentPopover];
                }

                UIPopoverController *popover = [[popoverClass alloc] initWithContentViewController:vc];
                currentPopover = popover;
                currentPopover.delegate = self;

                [popover presentPopoverFromBarButtonItem:sender
                                permittedArrowDirections:UIPopoverArrowDirectionAny
                                                animated:animated];
            }
        }
        //[aPopover release];
    } else {
        useNavController = YES;
    }

    if(useNavController) {
        if(modal) {
            [self presentModalViewController:vc animated:animated];
        } else {
            [self.view addSubview:vc.view];
        }
    }
}

Stepping with the debugger shows that the errors occur after [UIPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated: runs. Of note:

  • The program continues running just fine
  • No noticeable weirdness in UIImagePickerController's behavior when selecting an image or canceling
  • Happens in Simulator 3.2
  • Unable to reproduce on iPad running 3.2

Is this just another simulator bug?