使用MagicalRecord填充NSManagedObject时无法识别的选择器

时间:2014-08-12 16:14:32

标签: objective-c ios7 magicalrecord

我有一个iPad应用程序,我从Windows C#移植。我创建了实体和属性(图像中的parital列表):

enter image description here

这就是我在app中定义属性的方式:

.h file

.m file

这是在AppDelegate.m文件中初始化MagicalRecord(v2.3)的代码:

[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:@"bim.sqlite"];      
defaultContext = [NSManagedObjectContext MR_defaultContext];

我在DetailViewController.m文件中有这个代码:

#import "AppDelegate.h"
#import "Books.h"

@class Books;

@interface DetailViewController : UIViewController <UITextFieldDelegate> {
}

这是导致错误的代码:

- (IBAction)aAddRecordToCoreData:(UIButton *)sender {

Books *bks = [Books MR_createEntity];

bks.aAuthor = oAuthor.text;
bks.aBinding = oBinding.text;
bks.aBookDescription = oDescription.text;

这是我得到的错误:

-[Books setAAuthor:]: unrecognized selector sent to instance 

据我所知,这与我在另一款可在App Store中正常使用的iPad应用程序中使用的代码相同。我怀疑它与MagicalRecord有什么关系,但我不知道。我错过了什么?或做错了?

0 个答案:

没有答案