gpt4 book ai didi

iphone - 如何将 NSDictionary 转换为 NSMutableDictionary?

转载 作者:IT老高 更新时间:2023-10-28 11:41:11 25 4
gpt4 key购买 nike

我有一个现有的 NSDictionary:

{
"charts_count" = 2;
"created_at" = "2010-04-12T16:37:32Z";
exchange = NASDAQ;
"followers_count" = 259;
id = 8404;
industry = "<null>";
"messages_count" = 1436;
ric = "GRPN.O";
sector = "<null>";
symbol = GRPN;
title = Groupon;
"updated_at" = "2011-09-05T04:17:56Z";
}

如何获取这些内容并将其放入新的 NSMutableDictionary?

最佳答案

使用-mutableCopy

NSDictionary *d;
NSMutableDictionary *m = [d mutableCopy];

请注意,-mutableCopy 返回 id(在 Swift 中为 Any),因此您需要分配/强制转换为正确的类型。它会创建原始字典的浅拷贝。

关于iphone - 如何将 NSDictionary 转换为 NSMutableDictionary?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7313524/

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