My game is approved by the apple but the accelerometer is not working is my app. Here is the link of my app.
http://itunes.apple.com/in/app/the-plane-game-lite/id489110251?mt=8
This problem is occurring in my other too more apps which are build by using COCOS2D accelerometer code. Please help me out i have stuck here with no functionality. Here is my code. This is working fine in released code but not after approval from app store.
-(id)init
{
self.isAccelerometerEnabled = YES;
[self schedule:@selector(nextFrame:)];
}
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
// Set up variables
CGSize winSize = [CCDirector sharedDirector].winSize;
#define kFilteringFactor 0.5
#define kShipMaxPointsPerSec (winSize.height*0.5)
#define kRestAccelX (xCallib)
#define kMaxDiff 0.2
#define kRestAccelY (yCallib)
#define kMaxDiffY 0.1
UIAccelerationValue rollingX = 0;
float accelX;
// High pass filter for reducing jitter
rollingX = (acceleration.x * kFilteringFactor) + (rollingX * (1.0 - kFilteringFactor));
accelX = acceleration.x - rollingX;
// Calculate movement for x and y axis
float accelDiffX = accelX - kRestAccelX;
float accelFractionX = accelDiffX / kMaxDiff;
movementX = kShipMaxPointsPerSec * accelFractionX;
// Thresh holds for x and y axis movement
willMoveX = YES;
if (((movementX < 45.0f) && (movementX > -45.0f))) willMoveX = NO;
}
-(void)nextFrame:(ccTime)dt
{
CCSprite *plane =(CCSprite *) [self getChildByTag:80];
CGSize screenSize = [[CCDirector sharedDirector]winSize];
float oldX = [plane position].x;
float newX;
if (willMoveX) {
newX = [plane position].x + (movementX * dt);
} else newX = oldX;
if ((newX > (screenSize.width -45)) || newX < 45.0f ) {
newX = oldX;
}
[plane setPosition:ccp(newX,60)];
}