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 work 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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.