I can't seem to load an image, but I'm sure it is at the path I specify.
Here is the code that tries to load the image:
- (UIImage*) CPPlistImageToUIImage: (NSString *) CPPlistImage { /*TODO: Is this a memory leak? Find out*/ UIImage * ret = [UIImage imageNamed: CPPlistImage]; if(ret == nil){ RDLogString(@"Warning: Failed to load image: \"%@\"", CPPlistImage); } return ret; } And here is a function that lists all the files in the directory where this function looks:
- (void) lsOwnDirectory { NSError * error = [[NSError alloc] init]; NSArray * files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: pathToOwnDirectory error: &error]; for(NSString * file in files){ RDLogString(@"%@", file); } } And here is a sample of the output of both functions in the same run:
// CPPlist...Image telling he can't find/load the image 2009-11-29 02:12:51.510 CPPlayer[6452:207] CPConversation.m:113 Warning: Failed to load image: "/Users/nick/Library/Application Support/iPhone Simulator/User/Applications/D3403591-3A56-4F05-B4C1-C21DAAF918A2/CPPlayer.app/CP.Resources/CP.Conversations/Supermarkt/OIGNONS.png" ... // lsOwnDirectory is called AFTER CPPList...Image 2009-11-29 02:12:51.557 CPPlayer[6452:207] RootViewController.m:81 Contents of /Users/nick/Library/Application Support/iPhone Simulator/User/Applications/D3403591-3A56-4F05-B4C1-C21DAAF918A2/CPPlayer.app/CP.Resources/CP.Conversations/Supermarkt 2009-11-29 02:12:51.566 CPPlayer[6452:207] CPConversation.m:133 audio 2009-11-29 02:12:51.567 CPPlayer[6452:207] CPConversation.m:133 CPConversation.plist 2009-11-29 02:12:51.568 CPPlayer[6452:207] CPConversation.m:133 CPData.sqlite 2009-11-29 02:12:51.569 CPPlayer[6452:207] CPConversation.m:133 images 2009-11-29 02:12:51.570 CPPlayer[6452:207] CPConversation.m:133 OIGNONS.png
I have no clue why it can't find the file. One function sees it, the other does not, they seem to look in the same directory...
Any help, greatly appreciated,
Thanks in advance, Nick
Edit: I forgot to add that the code is executed and compiled by xcode for the iPhone OS 3.0. You probably got that from the tags but still.