How to Get Path of MOMD File in Core Data

2019-02-20 02:00发布

问题:

Ey guys, I have seen this question and have used

self.managedObjectContent= [NSManagedObjectModel mergedModelFromBundles:nil];

in my code, however, I would like to be able to print a filepath via NSLog to console with the full path of the momd file. Problem is I don't know how to go about extracting the path to the MOMD resource using objective c, when I try logging managedObjectContent to console it ends up printing very lengthy arcane data that I don't even care about. So how would I go about getting only the path of the momd file? Sample code please! Thanks in advance.

回答1:

Solved the problem a little while ago by looking at what files were in my resources folder and realizing they are .mom files rather than .momd files. So searching for the resource with the .mom file extension solved my problem.