Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
501 views
in Technique[技术] by (71.8m points)

ios - "Semantic error: Redefinition of '__ccContentScaleFactor' with a different type" in Cocos2D v2

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...