gpt4 book ai didi

iphone - 访问UIImagePickerController的didFinishPickingImage返回的图像属性时,获取EXC_BAD_ACCESS

转载 作者:行者123 更新时间:2023-12-01 18:03:07 29 4
gpt4 key购买 nike

我现在在模拟器中工作,当尝试访问UIImagePickerController的didFinishPickingImage返回的图像的属性时,出现EXC_BAD_ACCESS错误:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {
NSLog(@"Image size: %@", img.size);
}

我究竟做错了什么?

最佳答案

您正在尝试打印对象(“%@”格式说明符),但是size具有CGSize类型,其类型定义为plain struct。用

NSLog(@"Image size: %@", NSStringFromCGSize(img.size));

要么
NSLog(@"Image size: (%f, %f)", img.size.width, img.size.height);

关于iphone - 访问UIImagePickerController的didFinishPickingImage返回的图像属性时,获取EXC_BAD_ACCESS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5300491/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com