最佳答案
我假设单击“完成”按钮会调用取消选择器;在这种情况下,您可以尝试是否尝试实现委托(delegate)方法:
- (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;
}
关于iphone - 选择多个图像的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14324617/