When should I check "use scalar properties for primitive data types" during creating NSManagedObject objects?
What it will cost me (will my data base improve performance or be more lightweight)?

推荐答案

Before iOS 5 and OSX 10.7 scalar properties can't be auto-generated and you had to add setter and getter implementations, which cause some penalty. Auto-generated properties are optimized. I'm not aware of any other penalties.

Scalar and non-scalar properties are represented by the same types in DB, so there will be no change in DB's size. 

You should choose when to use scalar depending on the way you're going to access these properties. For example, you will need to wrap scalar properties in cocoa object if you're going to add them to collection (NSArray, NSSet, NSDictionary).

Objective-c相关问答推荐

try 从 id 确定类的类型时,Objective-C消息传递不合格的 id

如何使用第一个字符作为部分名称

UIAlertView 按钮操作

获取 Objective-C 类或实例的所有方法

具有匿名函数/块的 NSTimer?

xcode 未知类型名称

NSUserDefaults 的限制是什么?

从 UIScrollView 中删除所有子视图?

[MFMailComposeViewController canSendMail] 什么时候返回 NO

如何在 iOS 上将图像旋转 90 度?

判断 NSNumber 是否为 NaN

遍历 NSString 中所有字符的最有效方法

在 UITextField 文本上投影

Objective-C中的继承和类别有什么区别

@dynamic 在 Objective-C 中做了什么?

如何在 Xcode 7 中启用_BITCODE?

iPhone SDK:如何在视图中播放视频?而不是全屏

UITableView,我如何知道 cellForRowAtIndexPath 期间的哪个部分?

判断 UIViewController 是否即将从导航堆栈中弹出?

在 iOS 6.0 的 Xcode 4.5 中我没有要求的日志(log)消息