Master Data Error

I am collecting Json Data from the server using Restkit and I am showing this data retrieving from db. On my screen there is an update button that again performs the above operation.

Scenario: I have two Key and Profile tables that have one single relationship. I am extracting data from a DB using the following code

NSFetchRequest *fetchRequest = [Key fetchRequest]; [fetchRequest setRelationshipKeyPathsForPrefetching:[NSArray arrayWithObject:@"Profile"]]; [fetchRequest setIncludesSubentities:YES]; NSArray *sortedObjects = [Key executeFetchRequest:fetchRequest]; 

Above, the array returns the entire object in the database. but when I check that using a breakpoint, I got some basic data that was the reason for not showing all the data.

// All data in sortedObjects looks like this.

 <Key: 0x889f2f0> (entity: Key; id: 0x889e400 <x-coredata://981A476D-55AC-4CB4-BBD8-E0285E522412/Key/p1489> ; data: <fault>) 

Any idea

+6
source share
2 answers

This may be a misunderstanding of what an β€œerror” is.

As described in the Apple documentation :

Failure is a mechanism that uses Core Data to reduce application memory usage.

and

An error is a placeholder that represents a managed entity that is not yet fully implemented, or a collection entity that represents a relationship:

So, if you see the word β€œerror” in the logs when working with Core Data, this does not mean that an error has occurred. What unexpected behavior do you see in your application?

+20
source

In fact, you did not describe the problem. A master data error is not an error - it is more like a page error in a file system. It just means that the data has not yet been read. What you are describing is completely normal and expected. If you access any of the attributes of the returned objects, the error will be automatically filled in and you will see the results. Therefore, if your Key object has a name attribute, you can still search for values ​​for name and even register them if you want.

You can force the errors by adding this before executing the query for sampling:

 [fetchRequest setReturnsObjectsAsFaults:NO]; 

This is not necessary, although depending on what attributes you have and how many objects you have, you could use a lot more memory than is really necessary.

+19
source

All Articles