Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
351 views
in Technique[技术] by (71.8m points)

ios - Why is an NSDate in a Core Data managed Object converted to NSTimeInterval?

I have an object with a property with a Date type defined in my xcdatamodeld object. Why has it generated the NSManagedObject class with a NSTimeInterval? And how do I set a NSDate on it and then get an NSDate back off it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I get this if I check the "Use scalar properties for primitive data types" checkbox when I'm generating my files.

This is because NSTimeInterval is a double in disguise, whereas NSDate is a class that inherits from NSObject.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...