我的以下代码在iOS6 +上正常工作,但每次第三次时都会在iOS5上崩溃,是的,它工作正常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];
}
以下是它在崩溃中的说法
*** -[PLUISavedPhotosAlbumViewController hash]: message sent to deallocated instance 0x6dbd390
有些时间PLUISavedPhotosAlbumViewController
被UIImagePickerController
替换,但是日志格式相同Something
哈希]:消息被发送到解除分配的实例something
。它从第一段代码
[imagePop presentPopoverFromRect:self.profileImageButton.frame inView:self.profileImageButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];