我在XCode中运行Instruments并使用' Leaks'。我在解雇UIImagePickerController
后得到一个泄露的物体。
在详情面板中,我将泄露的对象视为UIStatusBarHideAnimationParameters
。
我无法理解这是从哪里来的。以下是我的代码 -
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
// Handles when the image has been picked
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
UIImage *originalImage, *editedImage, *imageToSave;
BOOL dismissed = NO;
[_activityIndicator show];
if (CFStringCompare((CFStringRef) mediaType, kUTTypeImage, 0) == kCFCompareEqualTo) {
editedImage = (UIImage *) [info objectForKey:UIImagePickerControllerEditedImage];
originalImage = (UIImage *) [info objectForKey:UIImagePickerControllerOriginalImage];
if (editedImage) {
imageToSave = editedImage;
} else {
imageToSave = originalImage;
}
NSData *imageData = UIImageJPEGRepresentation(imageToSave, 0.1);
imageToSave = [UIImage imageWithData:imageData];
// Display the image in the image view
[self displayImageInImageView:imageToSave];
[picker dismissViewControllerAnimated:YES completion:^{
[_activityIndicator show];
[self uploadPhotoToS3SyncWithImage:imageToSave];
[NSThread sleepForTimeInterval:1.5];
[_nextButton setEnabled:YES];
[_uploadPhotoButton setTitle:@"Upload Another" forState:UIControlStateNormal];
[self performSegueWithIdentifier:RIDEPhotoUploadToSetLocationSegue sender:self];
}];
dismissed = YES;
}
if (!dismissed) {
[picker dismissViewControllerAnimated:YES completion:nil];
}
}
当我在扩展详细信息面板中单击堆栈跟踪时,XCode突出显示行dismissed = YES
。但是AFAIK BOOL
变量不必解除分配。 picker
也没有ARC。
我在这里缺少什么?