答案 0 :(得分:2)
我假设点击“完成”按钮会调用取消选择器;在这种情况下,您可以尝试尝试实现委托方法:
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:^(void) {
NSLog(@"Cancelled pick");
};
}
看起来你正在呼叫release
- 你有没有使用ARC的原因?
如果我不得不猜测,我会说警报解雇实际上可能就像是
[imagePicker.delegate imagePickerControllerDidCancel:imagePicker];
但它已经发布,所以你看到了这个“锁定”问题。也许在调试器中单步执行并确保这些对象仍然存在。
编辑:
虽然它无法解决您的原始问题,但您可以在启动图像选择器之前检查可用空间,可能需要this so post建议:
- (uint64_t)freeDiskspace
{
uint64_t totalSpace = 0;
uint64_t totalFreeSpace = 0;
__autoreleasing NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
if (dictionary) {
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
NSLog(@"Memory Capacity of %llu MiB with %llu MiB Free memory available.", ((totalSpace/1024ll)/1024ll), ((totalFreeSpace/1024ll)/1024ll));
} else {
NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %d", [error domain], [error code]);
}
return totalFreeSpace;
}