the Reverend
the Reverend

Reputation: 12549

Getting nil when calling [NSBundle pathForResource] (Localization Issue)

I localized a text file in my application that currently is only supported in English enter image description here

I'm using this code to get the path:

 [[NSBundle mainBundle] pathForResource:@"Quotes" ofType:@"txt"]

On my system (Lion 10.7.2) it returns the expected path (English) when on any language

build/Beta/MyApp.app/Contents/Resources/en.lproj/Quotes.txt

But for some international users, this code is returning nil. I have not yet confirmed it but currently its only happened to Snow Leopard users.

Any Ideas? Thank you.

Edit:

Snow leopard theory is gone also, there is an English mac that also returns nil, this is confusing.

Upvotes: 1

Views: 1075

Answers (1)

the Reverend
the Reverend

Reputation: 12549

I got it, I have a workspace including ios & mac projects both sharing this file. But the ios version has the value "en" on Localization native development Region key in info.plist and the Mac has "English" I changed the Mac project to "en" and updated all the localized files.

Users that did not have "English" in their list language on System Preference -> Language & Text where getting nil.

Credit goes to Ken Thomases from the Apple Forums

Upvotes: 1

Related Questions