【问题标题】:Unrecognized selector - save to Core Data无法识别的选择器 - 保存到核心数据
【发布时间】:2016-08-07 05:32:08
【问题描述】:

请帮助解决问题 - 我不明白为什么会出现错误 - 无法识别的选择器发送到实例。

AppDelegate中这段代码执行时出现错误:

TMMonth *m = [NSEntityDescription insertNewObjectForEntityForName:@"TMMonth" inManagedObjectContext:self.managedObjectContext];
m.paymentMonth=@"month";
[self.managedObjectContext save:nil];

原因:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[TMMonth 名称]:无法识别的选择器发送到实例 0x7f993bdbbb00”

但在我的代码中,TMMonth 类中没有选择器“名称”。

https://github.com/maks-84/paymentApp.git

【问题讨论】:

  • 在问题中包含相关代码。不指向托管在其他地方的存储库的原因有很多,最简单的原因是没有人会通过它来找到您的问题。
  • 我理解并等待好人:)))

标签: ios objective-c xcode core-data


【解决方案1】:

在 AppDelegate 中执行代码时发生错误

TMMonth *m = [NSEntityDescription insertNewObjectForEntityForName:@"TMMonth" inManagedObjectContext:self.managedObjectContext];
m.paymentMonth=@"month";
[self.managedObjectContext save:nil];

reason: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TMMonth name]: unrecognized selector sent to instance 0x7f993bdbbb00'

但在我的代码中,TMMonth 类中没有选择器“名称”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多