gpt4 book ai didi

ios - dataWithContentsOfFile 返回空

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:11:36 34 4
gpt4 key购买 nike

NSString *path = dict[@"fileURL"];
NSData *imageData = [NSData dataWithContentsOfFile:path];

图像数据为空

dict[@"fileURL"] =
/var/mobile/Containers/Data/Application/0906AB53-CE1F-45EF-8E00-9D0B7C98956C/Documents/ccc/image/1446625127.png

我下载了设备容器,图像确实存在。怎么了?

最佳答案

检索您的文件失败。使用 -dataWithContentsOfFile:options:error: 查找失败的原因。

NSError* error = nil;
NSString *path = dict[@"fileURL"];
NSData *data = [NSData dataWithContentsOfFile:path options: 0 error: &error];

if (data == nil)
{
NSLog(@"Failed to read file, error %@", error);
}
else
{
// parse the value
}

关于ios - dataWithContentsOfFile 返回空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33517464/

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