2

我正在尝试展示一个 UIImagePickerController。它在模拟器上运行良好,但经过几次演示后,我在控制台中收到错误消息。

尝试注册的已过滤专辑列表超过 5 个。这将失败。

这是代码:

- (IBAction)imageSelectorPressed:(id)sender 
{
    UIImagePickerController* picker = [[[UIImagePickerController alloc] init] autorelease];
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
    {
        // Set source to the Photo Library
        picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;

    }
    picker.delegate = self; 
    UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
    self.imagePopOverController = popover;
    [self.imagePopOverController setDelegate:self];
    [self.imagePopOverController presentPopoverFromRect:[kepekBtn frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    [popover release]; 
}

-(void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
{
    [popoverController dismissPopoverAnimated:YES];
    [self setImagePopOverController:nil];
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [self.imagePopOverController dismissPopoverAnimated:NO];
    [image setImage:[info objectForKey:@"UIImagePickerControllerOriginalImage"]];
    picker = nil;
    [self setImagePopOverController:nil];
}

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [self.imagePopOverController dismissPopoverAnimated:NO];
    picker = nil;
    [self setImagePopOverController:nil];
}

更新:我检查了 iPad 上的联系人应用程序。编辑了一个人,它在控制台日志中有同样的错误。但它并没有崩溃,而我的应用程序却是。所以正确的问题是:我该如何解决?

4

0 回答 0