[swift-dev] about NSDictionary question
张辉
tianya_z at 163.com
Wed Feb 24 03:12:21 CST 2016
HI everybody:
I have a question about NSDictionary.
I defined a instance of NSDictionary, when I set value to this instance , it throw a exception.
code:
let userDict = NSDictionary()
userDict.setValue(self.userName.text!, forUndefinedKey: "userName2")
exception:
2016-02-24 00:50:26.931 TravelAssistant[1900:792534] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSDictionary0 0x7fc430404810> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key userName2.'
How to fix this bug?
thx.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160224/91ba8a6e/attachment.html>
More information about the swift-dev
mailing list