+ (NSDictionary *)optionsForPath:(NSString *)path mipmaps:(BOOL)mipmaps pma:(BOOL)pma
{
// This is a workaround for a nasty inconsistency between different iOS versions :|
NSString *osVersion = [[[UIDevice currentDevice] systemVersion] copy];
NSDictionary *options = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@(mipmaps), GLKTextureLoaderGenerateMipmaps, nil];
#if TARGET_IPHONE_SIMULATOR
BOOL applyPma = [osVersion compare:@"5.9"] == NSOrderedDescending;
#else
BOOL applyPma = [osVersion compare:@"6.9"] == NSOrderedDescending;
#endif
if (applyPma)
{
BOOL usePma = pma;
if([osVersion length] <= 3)
{
osVersion = [osVersion stringByAppendingString:@".0"];
}
int versionNumber =
[[osVersion stringByReplacingOccurrencesOfString:@"." withString:@""] intValue];
if(versionNumber >= 703)
{
usePma = false;
}
[options setValue:@(usePma) forKey:GLKTextureLoaderApplyPremultiplication];
}
return options;
}
This works great for me in simulator, 7.0, 7.0.3, 7.0.4 and will work on subsequent versions if they have the same settings.
It might be that versionNumber might need to be compared with lower value (701 or 702) but I don't have those versions to test with.