简体   繁体   English

是否有任何可行的算法来计算所有iOS设备(带或不带M7芯片)上的步数?

[英]Is there any working algorithm to count steps on all iOS devices (with or without M7 chip)?

I want to make an app. 我要制作一个应用。 that count user steps. 计算用户步骤。 So for that I have searched through the google but didn't found anything that could really help me. 因此,为此,我已经搜索了谷歌,但没有发现任何可以真正帮助我的东西。 Although I came to know that by using Accelerometer data we can get the steps and I tried with this code 尽管我知道通过使用加速度计数据我们可以得到这些步骤,但是我尝试使用此代码

-(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
    const float violence = 1.2;
        static BOOL beenhere;
        BOOL shake = FALSE;
        if (beenhere) return;
        beenhere = TRUE;
        if (acceleration.x > violence || acceleration.x < (-1* violence))
            shake = TRUE;
        if (acceleration.y > violence || acceleration.y < (-1* violence))
            shake = TRUE;
        if (acceleration.z > violence || acceleration.z < (-1* violence))
            shake = TRUE;
        if (shake) {  //(shake || length>=1.7)
            numSteps=numSteps+1;
            self.stepCountLabel.text = [NSString stringWithFormat:@"%d", numSteps];
        }
        beenhere = false;
}

But i am not getting the expected results. 但是我没有得到预期的结果。 So if anyone out there know a better algorithm or a link that could help me out. 因此,如果有人在那里知道更好的算法或链接可以对我有所帮助。 Plzz share Plzz分享

请检查CMStepCounter为iOS 7已弃用的iOS 8,适用于iOS 8+,退房CMPedometer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何实现CMStepCounter CoreMotion - M7芯片 - How to implement CMStepCounter CoreMotion - M7 Chip 如何使用M7协处理器计算iOS设备中的行进距离,速度,持续时间? - How to calculate distance travelled , speed , duration in iOS devices with M7 Co-processor? iOS:使用A5芯片的设备上的解密方法崩溃 - iOS: Decrypt method crash on devices with the A5 chip 如何在不使用任何第三方库的情况下跟踪来自iOS中所有设备的生产应用程序错误/崩溃 - How to track production app bugs/crashes from all devices in iOS without using any third party libraries iOS用户步骤数 - iOS User steps count 如果我在苹果 m1 上使用 react native 开发 iOS 应用程序,这些构建是否与不使用 ARM 芯片的设备兼容? - If I am developing iOS apps using react native on apple m1, will the builds have compatibility for devices not using the ARM chip? 无需任何网络即可将数据广播到附近的android / ios设备 - Broadcast data to nearby android/IOS devices without any kind of networking 触摸即可在平板电脑(而非任何iOS设备)上使用隐藏菜单 - Touch for Hidden Menu working on Tablet, not on any iOS Devices 在所有设备上布局,应遵循哪些步骤? - Layout on all devices, what are the steps to follow? iOS:使用M8芯片从iPhone 6获取当前的大气压 - iOS: Get current atmospheric pressure from iPhone 6 with M8 chip
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM