gpt4 book ai didi

ios - : ImageIO: PNG [5C][30][0D]I: invalid chunk type mean? 是什么意思

转载 作者:行者123 更新时间:2023-11-29 12:44:52 24 4
gpt4 key购买 nike

我将从图像选择器中提取的图像保存到 mysql 数据库中,我检索图像并尝试使用它创建一个 uiimage

[self.currentPicView setImage:[[UIImage alloc] initWithData:[[Person person] current_pic]]];

它给了我错误:

<Error>: ImageIO: PNG [5C][30][0D]I: invalid chunk type
<Error>: ImageIO: PNG [5C][30][0D]I: invalid chunk type

没有崩溃..图像只是不显示。我不知道该错误是什么意思或如何解决它。有什么想法吗?

附言:

[[Person person] current_pic]

包含 PNG 图像数据。Person 是一个单例。 current_pic 是 Person 中的一个 NSData 属性。我不能包含该代码,因为属性是合成的,所以我没有自己创建方法或覆盖它。

为了准备和上传(通过 POST 使用来自 here 的 EPUpload)图像,我这样做:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *image= [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSData *webData = UIImagePNGRepresentation(image);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:@"temp-file"];
[webData writeToFile:localFilePath atomically:YES];
NSLog(@"localFilePath.%@",localFilePath);
[self doUpload:localFilePath];
[[picker parentViewController] dismissViewControllerAnimated:YES completion:^{}];
}

更新:当我使用“webData”在 didFinishPickingMedia 方法中构造一个 UIImage 时,它​​没有给出错误,并且图像创建时没有错误。

我尝试使用 POST 将相同的 webData 直接上传到服务器,然后检索它并尝试从中创建另一个图像,但再次出现错误

最佳答案

当我的 bundle 中有两个同名的 png 图像时,我遇到了这个问题! orange.pngorange.png...将第二个重命名为 citrus.png,我什至没有意识到它们有相同的名字至少一个小时,每当我尝试加载该图像时,应用程序都会因此错误而崩溃。

关于ios - <Error> : ImageIO: PNG [5C][30][0D]I: invalid chunk type mean? 是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23900947/

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