When I test my application on iOS8 beta3 and beta5, I find an error related to [UIImage imageWithContentsOfFile:].
When image resources are stored in a subpackage of the main package, it returns nil if we initialize UIImage using the following method:
NSString *testBundlePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"bundle"];
NSBundle *bundle = [NSBundle bundleWithPath:testBundlePath];
NSString *path = [bundle pathForResource:@"play.png" ofType:nil];
UIImage *image = [UIImage imageWithContentsOfFile:path];
But when image resources are stored in the main package, initialization of UIImage can be done using the following method:
NSString *path = [[NSBundle mainBundle] pathForResource:@"play.png" ofType:nil];
UIImage *image = [UIImage imageWithContentsOfFile:path];
We detected this problem in iOS8 beta3 and still exists in iOS8 beta 5.
The Demo app directory structure was below:
XXX.app
|
|
|
|
|
|
|
......
- ? , iOS8. , . . , Apple , !