2

在我的前缀文件中,我有这个:

#define MR_SHORTHAND
#import "CoreData+MagicalRecord.h"


//this causes an unrecognized selector sent to instance crash
Apple *apple = [Face findFirstByAttribute:@"appleId" withValue:value];

//this works fine
Apple *apple = [Face MR_findFirstByAttribute:@"appleId" withValue:value];

//however this also works fine:
Orange *orange = [Face findFirstByAttribute:@"orangeId" withValue:value];

为什么我可以对某些实体使用速记而不对其他实体使用速记?

4

2 回答 2

0

以防万一有人在 2014 年和 2.2+ 版偶然发现此搜索结果,您需要安装以使用速记的 Cocopod 是

pod 'MagicalRecord/Shorthand', '~> 2.2';

根据以下线程

https://github.com/magicalpanda/MagicalRecord/issues/668

于 2014-10-18T14:54:41.853 回答
0

OK, I don't know if this is any help to you but I just fixed the problem I was having.

I had an entity called "EventMessage" and I didn't like the name so I renamed it to "Message".

This is when I started having the problems.

It was only running the app to the simulator from AppCode that I saw a message telling me that "Message is implemented twice".

I renamed the entity (and all the associated classes) back to "EventMessage" and it's working fine now.

Strange that it even compiled before though?!

Anyway, give that a go. Rename your Face entity to something that you know is unique "SoleilFace" for example and see if that fixes it.

于 2013-03-28T11:34:38.570 回答