开发者

Objective C Segmentation Fault when using "NO" value in NSDictionary

Why do I g开发者_如何学JAVAet a Segmentation Fault when using a NO value in an NSDictionary?


You can only put instances of objects in a dictionary, set or array. Primitive types are not allowed, hence the segmentation fault.

Use a NSNumber instead:

[ dict setObject: [ NSNumber numberWithBool: yourBool ] forKey: @"..." ];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜