I am trying to read files from the App bundle (and Library) directory using absolute path like this:
NSString* imagePath = "/var/mobile/Applications/7AC2295E-2775-41EA-B017-AB4048A09F0C/My.app/image.jpg";
When I check if the file exist using
[[NSFileManager defaultManager] fileExistsAtPath:imagePath];
it returns TRUE but when I try to open the image with
[UIImage imangeNamed:imagePath];
it returns nil.
What am I doing wrong here. I am scratching my head for few hours!! please help.
Read the documentation for
imageNamed:. It takes a name, not a full path, and searches the application bundle for it. If you want to use a full path you should use another initializer method, such asinitWithContentsOfFile:.