gpt4 book ai didi

objective-c - 无法将 JSON 放入 NSDictionary

转载 作者:行者123 更新时间:2023-12-04 02:44:07 25 4
gpt4 key购买 nike

我正在尝试将我的 JSON 放入 NSDictionary 中。我正在做以下事情:

 NSData *innerData = [json objectForKey:@"data"];
NSLog(@"Inner Description %@", innerData);

NSError* error;
NSDictionary* json = [NSJSONSerialization
JSONObjectWithData:innerData
options:kNilOptions
error:&error];
NSLog(@"dict: %@",json);

它在创建字典时一直崩溃并出现此错误。

-[__NSCFDictionary bytes]: unrecognized selector sent to instance 0x1e8d6100

有人能帮忙吗?

最佳答案

innerData 在运行时是一个 NSDictionary,而不是你期望的 NSData。

关于objective-c - 无法将 JSON 放入 NSDictionary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14071341/

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