Mani
Mani

Reputation: 17585

Could not find member 'setObject' : NSMutableDictionary

I've declared variable as

var optionDictionary : NSMutableDictionary!

try to set object for this variable in function, but got error

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..
    ....
}

Please anyone find this, please describe with brief-explanation..

Upvotes: 2

Views: 928

Answers (2)

John Estropia
John Estropia

Reputation: 17500

Seppo's answer is correct, but you don't even need to create an NSNumber:

self.optionDictionary["Key_Constant"] = Integer_Constant

Upvotes: 3

Seppo
Seppo

Reputation: 585

What if you just did the following?

self.optionDictionary[AVFormatIDKey] = NSNumber(int:TFORMAT_ID)

Upvotes: 1

Related Questions