Here's further information about the problem:
I am accessing the image for the UIImageView as such:
Code:
UIImage *backgroundImage = [UIImage imageNamed:@"parchment.jpg"];
I loaded the file parchment.jpg in my Resources folder in XCode.
To retrieve the xml files, I have some class methods that use NSHomeDirectory(). Each XML file is located in a subdirectory under the Resources folder in XCode:
Code:
+ (NSString *) directoryPathForVersion:(NSString *)version {
return [[self applicationPath] stringByAppendingPathComponent:version];
}
+ (NSString *) applicationPath {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *path = NSHomeDirectory();
return [path stringByAppendingPathComponent:[[fileManager contentsOfDirectoryAtPath:path error:NULL] lastObject]];
}
So in another method, I try to build a path to an individual file:
Code:
NSString *directoryName = @"esv";
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *path = [self directoryPthForVersion];
if (![fileManager fileExistsAtPath:path]) {
[NSException raise:InvalidBookException format:@"Invalid path %@", path];
}
This exception is never thrown in the simulator, but it's crashing the device on startup because I implement this logic in applicationDidFinishLaunching:
When I commented out this code in applicationDidFinishLaunching:, I get the error about not being able to access parchment.jpg. If I comment out both of these calls, the app builds on my device, but it of course doesn't work as I had intended.