I have a cocos2d app that works perfectly on retina iPads and iPhones, and I just went out and purchased an iPad pro to make sure it works ok, and sure enough, a large number of things are being displayed incorrectly.
After doing some debugging I determined it's because many elements have a scale of 0... So I did some more debugging and for example there is one line in my code that does:
self.scale = 1.0f;
If I put a breakpoint on that line and then step into the setter function that my class inherits from CCNode:
-(void) setScale:(float) s
{
_scaleX = _scaleY = s;
_isTransformDirty = _isInverseDirty = YES;
}
And.. then in the debugger I look at what the _scaleX and _scaleY ivars are getting set to:
(lldb) expr s
(float) $0 = 0
What?!?!?!?!!?!??!!?!? How in the world is 1.0 getting passed into this function and turning into 0??? Why is the iPad pro defying all the laws of computer science?
If I do this same thing on an retina iPad or iPhone 5 or iPhone 6 or iPhone 6 plus, the scale is 1.0, NOT 0.
Wow... So, turns out the reason for this was this object was being used with a protocol:
// stuff...
[self.menuItems enumerateObjectsUsingBlock:^(CCNode<MenuInteractable> *menuItem, NSUInteger idx, BOOL *stop) {
maxMenuItemSize = CGSizeMake(maxMenuItemSize.width, maxMenuItemSize.height * menuItem.scale);
// more stuff..
That protocol looked something like:
@protocol MenuInteractable <NSObject>
@property (nonatomic) CGFloat scale;
@end
...
I noticed that CCNode's setScale method signature used type float, not CGFloat.
So apparently having those two types not match up causes the iPad pro's architecture to behave in this way of zeroing out the value-- strange that this behavior only happens on the iPad pro, and not the iPad retina, iPhone 5/6, iPhone 6+.
changing the protocol to:
@protocol MenuInteractable <NSObject>
@property (nonatomic) float scale;
@end
fixed the problem.