Debugging Core Data managed objects with predicates
My application has the data models a little bit complicated. I need to debug a fetch request with different predicates.
Is there any fast way to see different results开发者_如何学运维 for different predicates? I am tired with changing only one predicate and I have to start again my navigation application with nearly 10 steps before.
An example of these predicates that I would like to see the results:
item = %@
item = %@ AND quantity = %@
item = %@ OR (startdate >= %@ AND enddate <= %@)
etc...
As using Core Data, I can not see the database with its' values to do some SELECTs.
You can add logic in your code to change the predicate and fetch again (maybe add a temporary button to trigger this and cycle through your various predicates).
You may also be interested in viewing the data in your SQLite file. Check out this answer to How view data stored in Core Data?
I'm not sure if it is any help, but if you want to quickly see the return results, go into gcc command line and write
po <name of array with results>
so if the array is items
po items
Will give all the returned results printed nicely in the console
To view your data inside of SQLite for free, just get FireFox. Then install SQLite Manager.
Cheers.
-RoLYroLLs
http://iphone.rolyrolls.com
精彩评论