gpt4 book ai didi

ios - 找不到成员 'setObject' : NSMutableDictionary

转载 作者:可可西里 更新时间:2023-11-01 00:53:55 25 4
gpt4 key购买 nike

我已将变量声明为

var optionDictionary : NSMutableDictionary!

尝试在函数中为该变量设置对象,但出现错误

Could not find member 'setObject'

func setOptionSetting()
{
self.optionDictionary = NSMutableDictionary() // No Error
self.optionDictionary!.setObject(NSNumber(int:Integer_Constant)!, forKey: "Key_Constant") // here, I got error..
....
}

请任何人找到这个,请用简短的解释描述..

最佳答案

Seppo 的回答是正确的,但您甚至不需要创建 NSNumber:

self.optionDictionary["Key_Constant"] = Integer_Constant

关于ios - 找不到成员 'setObject' : NSMutableDictionary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24156594/

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