“Semantic error: Redefinition of '__ccContentScaleFactor' with a different type” in Cocos2D v2

匿名 (未验证) 提交于 2019-12-03 01:13:01

问题:

i have developed a new game and it is running perfectly fine on my real ios devices and even on simulators but when i decided to submit it to AppStore it is giving error on this line.

extern CGFloat  __ccContentScaleFactor; 

and error is

cocos2d/Platforms/iOS/CCDirectorIOS.h:102:16: Redefinition of '__ccContentScaleFactor' with a different type: 'CGFloat' (aka 'double') vs 'float' 

can anyone please help me with this issue i just update xcode to 5.1. thanks

回答1:

Important Update:


Cocos2D v2.2 with 64-Bit fixes has been released.

I strongly suggest every cocos2d v2.x developer to upgrade to this version rather than applying the quick fix below. There are many 64-Bit compatibility issues lurking in cocos2d v2.0 and v2.1, which may rear their ugly head in weird bugs, visual glitches or more compile errors - depending on the app.

Beginning in February 2015 Apple will only accept new apps and app upgrades which include 64-Bit binaries. So it's highly recommended to get your code and cocos2d to a proper working state on 64-bit devices.


Quick & dirty fix only for this particular issue:

Edit the line the compiler complains about, change CGFloat to float so that it reads:

extern float  __ccContentScaleFactor; 

However this indicates that xcode is building the arm64 slice. For cocos2d-iphone v2.x it is best to disable/remove arm64 from supported architectures because Cocos2D v2.1 and earlier are not fully compatible with 64bit devices!

There can be weird bugs and side-effects when running a Cocos2D v2.1 or earlier app compiled as 64-bit code and running on a 64-Bit device (iPhone 5S and newer). These issues may not occur on the iOS Simulator.



回答2:

As now developers are finding new solution for this problem . because apple says ARM64 will be compulsory from February, 2015 . so you can fix this by just changing:

   CGFloat 

to

    float 

where every you get this problem in coco2d project. thanks



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!