hook38 hook38 - 1 year ago 119
iOS Question

Disable MagicalRecord error messages and warnings

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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download