在创建字典的时候发现一个有趣的事 再给字典赋值的时候,SB了,需要判断存入字典的键和值都不可以是 nil
不然你可以遇到
-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
恭喜那么就是有值或者键是nil了,所以一定要加非空的判断。
NSAssert(key != nil,value !=nil @"Initial dictionary key or value can't is nil");
谨记谨记!!!
网友评论