Disable MagicalRecord error messages and warnings

我的未来我决定 提交于 2019-12-21 07:26:35

问题


I just started using MagicalRecord, and this might be a stupid question, but it's really bothering me... I am using MagicalRecord with sqlite, and when I initiate MagicalRecord, I used

[MagicalRecord setupCoreDataStackWithStoreNamed:@"OrderSystem.sqlite"];

and it produced the following messages:

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

When I tried to store my entity with the following code using a background thread:

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

And I got the following error messages:

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 Context MAIN THREAD *

2012-10-16 17:05:20.121 OrderSystem[4523:c07] -NSManagedObjectContext(MagicalRecord) contextWillSave: Context : * DEFAULT 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

When I check my stored data entity using findAll, it does seem to be stored in the database. And if I close the application completely, and relaunch the application, the entity is still there (which suggest the entity had been stored persistently, and not just in the memory). So it seems like everything is working, but any idea what are those error messages? and is there any way to turn them off? or solve them? because it's blocking my other NSLog...

Thank you


回答1:


found it. add #define MR_ENABLE_ACTIVE_RECORD_LOGGING 0 in your Prefix.pch file before #import "CoreData+MagicalRecord.h"




回答2:


In case you use pods add preprocessor macro MR_ENABLE_ACTIVE_RECORD_LOGGING=0 to magical record project like this:




回答3:


swift

MagicalRecord.setLoggingLevel(MagicalRecordLoggingLevel.Off)

objC

[MagicalRecord setLoggingLevel:MagicalRecordLogLevelOff];

put it in your AppDelegate when the application didFinishLaunchingWithOptions




回答4:


It looks like you still have errors to fix. I suggest not ignoring those during development...



来源:https://stackoverflow.com/questions/12908584/disable-magicalrecord-error-messages-and-warnings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!