iDevGames Forums
Images loading in simulator but not on device - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Images loading in simulator but not on device (/thread-2049.html)



Images loading in simulator but not on device - fretmunky - Dec 11, 2008 11:12 AM

I've got a whacky problem.

I'm loading 5 images with
Code:
CGImageRef image = [UIImage imageNamed:string].CGImage;

Now, in the simulator all 5 images are loading fine. However, on the device only one of them is being loaded and for the rest, nil is returned. It doesn't matter what order i load these images in it's always the same ones which return nil and the same one which works. The images are practically the same; same dimensions, same colour space, same number of alpha channels.

I've even tried making a copy of the image that works and loading this in but with no success.

Also, all the images have been copied to resources and I have set the current working directory to the resource bundle.

Any ideas on what's happening here? I'm not getting any error messages printed in the the debug console Huh

Any help at all would be fantastic.

Cheers,

Chris.


Images loading in simulator but not on device - fretmunky - Dec 11, 2008 11:29 AM

Ok never mind that, problem solved!

For future reference of any readers... case of filenames/paths does not matter when building a 'simulator' target but it does when building a device target. Silly mistake I know but strange nonetheless in the differences between device and 'simulator'.


Images loading in simulator but not on device - imaumac - Dec 11, 2008 11:57 AM

thanks for the info


Images loading in simulator but not on device - ThemsAllTook - Dec 11, 2008 12:50 PM

fretmunky Wrote:For future reference of any readers... case of filenames/paths does not matter when building a 'simulator' target but it does when building a device target. Silly mistake I know but strange nonetheless in the differences between device and 'simulator'.

More accurately, the iPhone uses a case-sensitive filesystem, which is a (non-default) option for the Mac, too. For this reason, if you're developing on a case insensitive system and your file names don't match up, your application may not run on everyone's system. So, it's important to always, always, always write file names with the exact same case in your code as on the filesystem.


Images loading in simulator but not on device - fretmunky - Dec 12, 2008 02:27 AM

Quote:More accurately, the iPhone uses a case-sensitive filesystem, which is a (non-default) option for the Mac, too. For this reason, if you're developing on a case insensitive system and your file names don't match up, your application may not run on everyone's system. So, it's important to always, always, always write file names with the exact same case in your code as on the filesystem.


Indeed, as I said it was a silly mistake on my part. A typo that cost me hours of time scratching my head LOL