Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - UIImage imageNamed: returns null on device

Tags:

ios

ios6

uiimage

[UIImage imageNamed:filename]

This method returns null only on the device.

I know it's known problem and it's usually due to the fact that simulator is case insensitive. I have tried solutions proposed here: UIImage imageNamed returns nil

But nothing worked out for me.

The case is simple: I have 4 files named:Bar@2x~ipad.png, Bar@2x~iphone.png, Bar~ipad.png, Bar~iphone.png. All of them are in project with target checkbox checked.

NSLog(@"%@",[UIImage imageNamed:@"Bar"]);

That line of code gives me null for device and I really have no idea what I'm doing wrong right now.

like image 450
Gricha Avatar asked Apr 07 '13 18:04

Gricha


1 Answers

I did have such a problem recently too.

After playing with filenames and paths sometimes it helps when you clean and rebuild your project.

like image 74
Adrian Avatar answered Sep 24 '22 21:09

Adrian