try step by step.
First enter the set path within your main package:
NSString *myBundlePath=[[NSBundle mainBundle] pathForResource:MyBundle ofType:@"bundle"];
Check for anything in the kit. This is more suitable for double checking. Once it works, you can omit this code. But it’s always good to check things.
NSBundle *imageBundle=[NSBundle bundleWithPath: myBundlePath]; NSArray *allImageURLs=[imageBundle URLsForResourcesWithExtension:@"png" subdirectory:nil]; NSLog(@"imageURLS: %@",allImageURLS);
Since you already have the path to the package, add the image name to the path. Or you can just pull it from the list of URLs that you already have in the above code.
NSString *myImagePath=[myBundlePath stringByAppendingPathComponent:@"test.png"]; NSLog(@"myImagePath=%@",myImagePath);
Then, since you have the full path, upload the image
UIImage *testImage = [UIImage imageWithContentsOfFile:backgroundImagePath];
Code taken from the delivery application.
Luck
Tim
source share