在Swift中调试对象时,重复对Coredata实体的引用

发布于 2025-01-22 12:36:03 字数 1516 浏览 1 评论 0原文

我可能只是简单地理解了这一点,但是当我创建练习实体并在调试器中查看内容时,我会得到对实体类型的重复引用。

练习+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 {

}

这是XCDATAMODELD配置:

有什么想法,为什么我创建了一个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.

enter image description here

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:
enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情绪操控生活 2025-01-29 12:36:03

您使用的变量视图无法看到托管对象(或大多数对象)的属性值。如果要检查属性值,请使用调试控制台。当您停在屏幕截图中时,您应该能够使用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 of newExercise, or you can use commands like po newExercise.exerciseName to see individual property values.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文