开发者

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

开发者 https://www.devze.com 2023-03-01 06:08 出处:网络
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.

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

精彩评论

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