MR_SHORTHAND不工作 [英] MR_SHORTHAND does not work

查看:132
本文介绍了MR_SHORTHAND不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MagicalRecords,但由于某种原因,MR_SHORTHAND不适合我。

I use MagicalRecords but by some reason MR_SHORTHAND does not work for me.

我已将以下这些行添加到Prefix.pch

I have added these lines below to Prefix.pch

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

如果应用程序调用+ createEntity方法,应用程序会终止,因为无法识别的选择器。但是如果我写MR_createEntity一切都很好。

In case when app calls + createEntity method the app terminates due unrecognized selector. But if I write MR_createEntity everything works fine.

Team *team = [Team MR_createEntity]; // This line works

Team *team = [Team createEntity]; // This line does not work

with reason: '+[Team createEntity]: unrecognized selector sent to class 0x74b8c'


推荐答案

我知道我们在这个答案之前没有公开发布,但我们决定不再使用速记支持,即将推出的MR3版本。

I know we haven't announced it publicly prior to this answer, but we've decided to deprecate shorthand support, and remove it in the upcoming MR3 release.

速记支持是一个有趣的想法和功能,但它不是我们想要维护的。我们更愿意专注于使MagicalRecord的以数据为中心的部分尽可能的坚固和可重用。

Shorthand support is an interesting idea and feature, but it is not something we want to maintain. We would rather focus our efforts on getting the data centric part of MagicalRecord to be as solid and reusable as possible.

也就是说,你肯定欢迎自己修复它并向MagicalRecord的旧分支提交补丁。有些事情是:

That said, you're certainly welcome to fix it yourself and submit a patch to the older branch of MagicalRecord. Some things to look at are:


  • 确保包含速记选择器,如果不存在则添加新的选择器

  • 确保在调用之前已经使用过MagicalRecord类。

  • 如果您使用Cocoapods,则可能需要将您的pod规范更新为MagicalRecord / Shorthand

这篇关于MR_SHORTHAND不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆