gpt4 book ai didi

ios - 如何从 NSMutableArray 中删除 ID 对象?

转载 作者:行者123 更新时间:2023-11-29 03:33:49 24 4
gpt4 key购买 nike

我正在尝试从存储在字典中的数组中删除一个对象。我已经能够使用以下代码按索引删除对象:

[compHandHighValuesArray removeObject:[NSNumber numberWithInt:[[highCardDictionary    valueForKey:[cardsShuffled objectAtIndex:1]] intValue]]];

但是现在我想将 [cardsShuffled objectAtIndex:1] 更改为 ID 变量。当我将代码替换为:

[compHandHighValuesArray removeObject:[NSNumber numberWithInt:[[highCardDictionary valueForKey:[compCardOneTitle]] intValue]]];

我收到“预期标识符”错误。我错过了什么?

最佳答案

这个:

[highCardDictionary valueForKey:[compCardOneTitle]]

不是有效的语法。我猜 compCardOneTitle 是您的 ID,但您没有说明 ID 是什么...

如果ID是一个字符串/键,那么你应该有:

[highCardDictionary valueForKey:compCardOneTitle]

关于ios - 如何从 NSMutableArray 中删除 ID 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19436732/

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