CCFiniteTimeAction* action = CCSequence::create( CCRepeat::create(CCAnimate::create(animation), 1) ,CCCallFunc::create(this, callfunc_selector(RjsCharacter::Stand)) );
Which compiled and ran fine for the ios simulator but compiled and run time failed with a bad access error on my devices.
This was happening because of compiler optimisation failing to interpret CCSequence::create()’s “…” property correctly. Inside of CCSequence::create() it would loop correctly through the while loop in the simulator but loop more than the required times when run on the device. Hence the bad access error.
The solution is to use CCArray:
CCArray* actions = CCArray::create(); actions->addObject(CCRepeat::create(CCAnimate::create(animation), 1)); actions->addObject(CCCallFunc::create(this, callfunc_selector(RjsCharacter::Stand))); CCFiniteTimeAction* action = CCSequence::create(actions);
I would recommend you deprecate all methods that use this property. In my experience the use of the property “, …” is fraught with problems that are beyond the control of the library. It likely requires you to set specific compiler flags in order to get your framework working which generally turns people off. Also, not everyone is going to be able to guess that it was a compile time issue and would likely blame cocos2d-x for not working.