In my app when I make archive (Product -> Archive) the share to get the .api then go to iTunes and install in my iPhone I have notice in the device console that accelX always equal to zero why?
Note if I click play in the Xcode all works properly.
This is my code :
- (void)accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration {
CGSize winSize = [CCDirector sharedDirector].winSize;
static float accelX = 0;
#define kFilteringFactor 0.1
#define kRestAccelX 0.6
#define kShipMaxPointsPerSec (winSize.height*0.5)
#define kMaxDiffX 0.2
UIAccelerationValue rollingX;
rollingX = (acceleration.x * kFilteringFactor) +
(rollingX * (1.0 - kFilteringFactor));
accelX = acceleration.x - rollingX;
NSLog(@"accelX :%f",accelX);
float accelDiffX = kRestAccelX - ABS(accelX);
float accelFractionX = accelDiffX / kMaxDiffX;
float pointsPerSecX = kShipMaxPointsPerSec * accelFractionX;
_shipPointsPerSecY = pointsPerSecX;
}
the solution is to replace:
UIAccelerationValue rollingX;
by
UIAccelerationValue rollingX = 0;