【问题标题】:Property not found on object of … error debugging properties on NSManagedObjects在 NSManagedObjects 上的错误调试属性的对象上找不到属性
【发布时间】:2016-02-04 10:45:08
【问题描述】:

我之前多次使用 coredata 创建了一个新项目,但我注意到较新的 Xcode 不允许我调试我的 NSManagedObject 上的属性,这些属性引用另一个不同的 NSManagedObject

让我用一个例子来解释。 MLP 代表 MyLittleProject

我有以下物品:

MLPPerson+CoreDataProperties.h

@property (nullable, nonatomic, retain) MLPCard *card;

MLPCard+CoreDataProperties.h

@property (nullable, nonatomic, retain) NSString *cardID;

当我在代码中并尝试时:

NSLog(@“%@“, myPerson.card.cardID);

效果很好,但是当我尝试在调试控制台中打印时:

po myPerson.card.cardID

我收到一个错误:

错误:在“MLPPerson *”类型的对象上找不到属性“卡”

我很困惑,因为这曾经在我从事的旧项目中效果很好。

【问题讨论】:

    标签: ios objective-c xcode debugging core-data


    【解决方案1】:

    我找到了答案:以前这样做的原因是属性在一个类中,而现在它们在一个类别中。

    即其他项目中 MLPPerson+CoreDataProperties.h 的内容是 MLPPerson.h 的一部分。

    现在,要让调试控制台打印这些,您需要使用

    po [myPerson card] cardID]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-10
      • 2011-07-19
      • 2013-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-27
      相关资源
      最近更新 更多