Monday, May 30, 2011

iPhone is case-sensitive

I had a strange issue today while programming my iPhone. Although the application was running find on iOS Simulator, it crashed on my iPhone 4.

The iPhone was generating the following error:
2:53 unknown Pickers[15251] : *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'

The problem was a wrongly typed file name. The "wrong" command was:
NSString *path = [[NSBundle mainBundle] pathForResource:@"Crunch" ofType:@"wav"];

and I had to change it to (notice the small __c__)
NSString *path = [[NSBundle mainBundle] pathForResource:@"crunch" ofType:@"wav"];

The funny thing was that both of them were working on the iOS Simulator but only the second one on my iPhone! So, iPhone is case-sensitive.

No comments: