Difference between objectForKey and valueForKey?

后端 未结 5 1944
清歌不尽
清歌不尽 2020-11-22 13:25

What is the difference between objectForKey and valueForKey? I looked both up in the documentation and they seemed the same to me.

5条回答
  •  粉色の甜心
    2020-11-22 14:04

    Here's a great reason to use objectForKey: wherever possible instead of valueForKey: - valueForKey: with an unknown key will throw NSUnknownKeyException saying "this class is not key value coding-compliant for the key ".

提交回复
热议问题