在Swift中调试对象时,重复对Coredata实体的引用
我可能只是简单地理解了这一点,但是当我创建练习
实体并在调试器中查看内容时,我会得到对实体类型的重复引用。
练习+coredataproperties文件是标准的:
import Foundation
import CoreData
extension Exercise {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Exercise> {
return NSFetchRequest<Exercise>(entityName: "Exercise")
}
@NSManaged public var exerciseDuration: Int16
@NSManaged public var repeatNo: Int16
@NSManaged public var restDuration: Int16
@NSManaged public var exerciseName: String
@NSManaged public var id: UUID
@NSManaged public var associatedWorkout: NSSet?
}
// MARK: Generated accessors for associatedWorkout
extension Exercise {
@objc(addAssociatedWorkoutObject:)
@NSManaged public func addToAssociatedWorkout(_ value: WorkoutSet)
@objc(removeAssociatedWorkoutObject:)
@NSManaged public func removeFromAssociatedWorkout(_ value: WorkoutSet)
@objc(addAssociatedWorkout:)
@NSManaged public func addToAssociatedWorkout(_ values: NSSet)
@objc(removeAssociatedWorkout:)
@NSManaged public func removeFromAssociatedWorkout(_ values: NSSet)
}
extension Exercise : Identifiable {
}
有什么想法,为什么我创建了一个debug模式的对象值?我是否在代码中做了一些事情来引起这种重复?
I may be simply understanding this incorrectly, but when I created an Exercise
entity and looked at it contents in the debugger I get this repeating reference to the Entity type.
The Exercise+CoreDataProperties file is standard:
import Foundation
import CoreData
extension Exercise {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Exercise> {
return NSFetchRequest<Exercise>(entityName: "Exercise")
}
@NSManaged public var exerciseDuration: Int16
@NSManaged public var repeatNo: Int16
@NSManaged public var restDuration: Int16
@NSManaged public var exerciseName: String
@NSManaged public var id: UUID
@NSManaged public var associatedWorkout: NSSet?
}
// MARK: Generated accessors for associatedWorkout
extension Exercise {
@objc(addAssociatedWorkoutObject:)
@NSManaged public func addToAssociatedWorkout(_ value: WorkoutSet)
@objc(removeAssociatedWorkoutObject:)
@NSManaged public func removeFromAssociatedWorkout(_ value: WorkoutSet)
@objc(addAssociatedWorkout:)
@NSManaged public func addToAssociatedWorkout(_ values: NSSet)
@objc(removeAssociatedWorkout:)
@NSManaged public func removeFromAssociatedWorkout(_ values: NSSet)
}
extension Exercise : Identifiable {
}
And here is the xcdatamodeld config:
Any ideas why I cannot view the values of the object in debug mode once I've created it? Have I done something in my code to cause this repetition?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的变量视图无法看到托管对象(或大多数对象)的属性值。如果要检查属性值,请使用调试控制台。当您停在屏幕截图中时,您应该能够使用
po neweSercise
查看newExercise
的属性,或者您可以使用po po的命令neweSercise.ciscisename
查看单个属性值。The variables view you're using can't see into the values of properties of managed objects (or of most objects). If you want to inspect the property values, use the debug console. When you're stopped on the line in your screenshot, you should be able to use
po newExercise
to see properties ofnewExercise
, or you can use commands likepo newExercise.exerciseName
to see individual property values.