Search code examples
iosimagecore-dataphasset

Save a PHAsset in Core Data?


I have a custom image picker where I load all the images in my photo library. I am wanting to save those image locations in coredata. I have successfully gotten the file path, but when I try to load that I get a permission issue. How do I store a PHAsset into core data in such a way that I am not saving that actual image?

If there is any code I should show let me know.

Thanks in advance.


Solution

  • Ok, so I was able to solve the problem. Instead of trying to access the image with the path, I saved the local identifier, and then used

    fetchAssetsWithLocalIdentifiers
    

    Everything seems to work as desired now.