iDevGames Forums
Works in the simulator, but not on my 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: Works in the simulator, but not on my device... (/thread-2130.html)



Works in the simulator, but not on my device... - duncster - Nov 19, 2008 01:56 AM

Hi all!

First time here, so please be gentle...

I have modified the bouncing ball tutorial posted on iCodeBlog.com. Basically, I have altered it so the ball imageView is created programatically (via a new "Ball" class). This works great in the simulator (I even worked out how to pick it up and move it around!), but it just refuses to display the ball on the phone. The original tutorial worked fine (ie, with the ball defined within UI Builder).

Does anyone know why this might be?

The code which creates an instance of my ball is as follows (and sticking a trace in there confirms that it does run through this method...):
- (void)setUpBall {
//Create an instance of the ball...
Ball *aBall = [[Ball alloc] init];
self.ball = aBall;
[aBall release];
ball.center = self.view.center;
[self.view addSubview:ball];
}

Any help appreciated!!

Cheers,

D.


Works in the simulator, but not on my device... - duncster - Nov 19, 2008 07:19 AM

Sorted it!!

It seems the Simulator doesn't care if you get the case wrong in when referencing image file names... (ie, "Ball.png" should have been "ball.png"), whereas the device does!!

Cheers,

D.


Works in the simulator, but not on my device... - AnotherJake - Nov 19, 2008 07:47 AM

Thanks for letting us know about that. It serves as a good reminder about case-sensitivity. Those bugs can be a pain to track down sometimes.


Works in the simulator, but not on my device... - Bachus - Nov 19, 2008 03:16 PM

Interesting. Is the iPhone formatted as UFS? I figured it would be HFS+ like most Mac OS X installs.


Works in the simulator, but not on my device... - AnotherJake - Nov 19, 2008 03:24 PM

It does say in the guide at the very bottom of the file and data management section:

Quote:The file system for iPhone OS–based devices is case sensitive. Whenever you work with filenames, you should be sure that the case matches exactly or your code may be unable to open or access the file.

Very easy to miss that little tidbit...