ios – 禁用MagicalRecord错误消息和警告

前端之家收集整理的这篇文章主要介绍了ios – 禁用MagicalRecord错误消息和警告前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚开始使用MagicalRecord,这可能是一个愚蠢的问题,但它真的让我困扰…
我正在使用MagicalRecord与sqlite,当我启动MagicalRecord,我用
[MagicalRecord setupCoreDataStackWithStoreNamed:@"OrderSystem.sqlite"];

并产生以下消息:

2012-10-16 16:54:48.966 OrderSystem[4135:c07] +NSManagedObjectContext(MagicalRecord) MR_contextWithStoreCoordinator: -> Created : Context * MAIN THREAD *

当我尝试使用后台线程存储我的实体与以下代码

[MagicalRecord saveInBackgroundWithBlock:^(NSManagedObjectContext *localContext){        
    Menu *localMenu = [menu inContext:localContext];        
    localMenu.name = menu.name;
    localMenu.menuid = menu.menuid ;        
}];

我收到以下错误消息:

2012-10-16 17:05:20.118 OrderSystem[4523:4603] +MagicalRecord(ErrorHandling) defaultErrorHandler: Error Message: The operation couldn’t be completed. (Cocoa error 133000.)

2012-10-16 17:05:20.118 OrderSystem[4523:4603] +MagicalRecord(ErrorHandling) defaultErrorHandler: Error Domain: NSCocoaErrorDomain

2012-10-16 17:05:20.119 OrderSystem[4523:4603] +MagicalRecord(ErrorHandling) defaultErrorHandler: Recovery Suggestion: (null)

2012-10-16 17:05:20.119 OrderSystem[4523:4603] -NSManagedObjectContext(MagicalSaves) MR_saveWithErrorCallback: NO CHANGES IN CONTEXT : Context – NOT SAVING

2012-10-16 17:05:20.120 OrderSystem[4523:c07] -NSManagedObjectContext(MagicalSaves) MR_saveWithErrorCallback: -> Saving : * DEFAULT @H_301_31@ Context MAIN THREAD *

2012-10-16 17:05:20.121 OrderSystem[4523:c07] -NSManagedObjectContext(MagicalRecord) contextWillSave: Context : * DEFAULT @H_301_31@ Context MAIN THREAD * is about to save. Obtaining permanent IDs for new 1 inserted objects

2012-10-16 17:05:20.142 OrderSystem[4523:1303] -NSManagedObjectContext(MagicalSaves) MR_saveWithErrorCallback: -> Saving : * BACKGROUND SAVE * Context

2012-10-16 17:05:20.142 OrderSystem[4523:1303] -NSManagedObjectContext(MagicalRecord) contextWillSave: Context : * BACKGROUND SAVE * Context is about to save. Obtaining permanent IDs for new 1 inserted objects

当我使用findAll检查我存储的数据实体时,它似乎存储在数据库中.如果我完全关闭应用程序,并重新启动应用程序,那么实体仍然存在(这表明实体已经被持久存储,而不仅仅是在内存中).所以似乎一切都正常,但是任何想法是什么错误信息?有什么办法把它们关掉吗?还是解决他们?因为它阻止我的其他NSLog …

谢谢

解决方法

找到了.在#import“CoreData MagicalRecord.h”之前的Prefix.pch文件添加#define MR_ENABLE_ACTIVE_RECORD_LOGGING 0

猜你在找的iOS相关文章