This may be a problem of internationalization. According to the documentation , pathForResource returns only zero if the file is not found. But he also says:
First, the method searches for the corresponding resource file in the non-localized resource directory of the specified package. [...] If the corresponding resource file is not found, it will be displayed at the top level of any available ".lproj" directories for a particular language. (The search order for language directories matches user preferences.) It does not recurs through other subdirectories at any of these locations.
Perhaps you are trying to use your code on different machines with different languages ββor a simulator.
In addition, [NSBundle mainbundle] can return nil, so making any call on this also returns nil.
[...] Be sure to check the return value to make sure you have a valid package.
txulu source share