0

我的以下代码在 iOS6+ 上运行良好,但它在 iOS5 上每3 次崩溃一次,是的,它在 2 次正常工作并在第 3 次崩溃。我没有做任何花哨的事情,只是一次又一次地点击同一个按钮。调用此方法的按钮,其中包含以下代码行。

self.imagePopover = nil;
UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
UIPopoverController *imagePop = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[imagePop presentPopoverFromRect:self.profileImageButton.frame inView:self.profileImageButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
self.imagePopover = imagePop;

并且在

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
     picker.delegate = nil;
     [self.imagePopover dismissPopoverAnimated:YES];
}

以下是它在 consol for crash 中所说的

*** -[PLUISavedPhotosAlbumViewController hash]: message sent to deallocated instance 0x6dbd390

一些时间PLUISavedPhotosAlbumViewController被替换为UIImagePickerController但 log 的格式是相同的Somethinghash]: message sent to deallocated instance something。它在第一段代码的下一行崩溃

 [imagePop presentPopoverFromRect:self.profileImageButton.frame inView:self.profileImageButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
4

0 回答 0