Search code examples
iosobjective-ciphonephotokit

How to direct link to photo on iPhone device?


I'm trying to modify photo on iOS device from my app. But all methods described by Apple or somebody else get me at all nothing.

For example, I try to use ImageIO and PhotosKit to work with raw image data. To write it to file, I create CGImageDestination and write it with CGImageDestinationFinalize, but this works only at simulator (change directly file of image). On device last function finalize with success, but at photo file it write nothing.

After some time, I can guess, that URL, that I get from PHAsset, when app launching on device, not direct link to file. But I do not know how get url in other way. Can you help me?

P.S. Sorry for my English :)


Solution

  • On the device the photo/videos files of the Photo-Library are sandboxed. So you can't work with files URL directly. Instead to manipulate an image, take a look at the classes PHContentEditingInput and PHContentEditingOutput.