How can I get the file path from a UIImage?

ios, objective-c, path, uiimage

Solution

if you already have the image i.e. have added the file to your resources, you can use this to get the file path;

NSString *string = [[NSBundle mainBundle] pathForResource:@"IMAGE_FILE_NAME" ofType:@"jpg"]; // or ofType:@"png", etc.

Problem

Usually it's the other way around, you use the path to display the image. I was wondering if you can get the path if you already have the image.

Original source