# iPhone 步数 **Repository Path**: gnode/Pedometer ## Basic Information - **Project Name**: iPhone 步数 - **Description**: 获取 iPhone 健康 App 中前一天的步数 - **Primary Language**: Swift - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2019-05-27 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # iPhone 步数 #### 介绍 获取 iPhone 健康 App 中前一天的步数 #### 软件架构 软件架构说明 Pedometer - Pedometer // sdk使用Demo - PedometerLib.framework // framework #### SDK升级文档 1. 新工程需要在 info.plist添加 http 允许 ![http](https://images.gitee.com/uploads/images/2019/0703/155240_637304de_1433687.png "屏幕截图.png") 2. 运动数据授权,运动数据授权的描述根据项目如实填写 ![info.plist_1](https://images.gitee.com/uploads/images/2019/0624/104059_267eccdb_1433687.png "屏幕截图.png") **将上方图片中的授权删除,改为下方图片中的运动数据授权** ![info.plist_2](https://images.gitee.com/uploads/images/2019/0703/161521_5eb068af_1433687.png "屏幕截图.png") 3. 在 项目工程->Capabilities->关闭 HealthKit ![healthkit](https://images.gitee.com/uploads/images/2019/0703/160520_64ac4c06_1433687.png "屏幕截图.png") 4.删除项目中HealthKit相关的文件 ![文件](https://images.gitee.com/uploads/images/2019/0703/160207_ca02a11f_1433687.png "屏幕截图.png") 5. 删除项目中 HealthKit 的引用 #### 使用说明 1. git clone 2. Pedometer示例工程中 首次使用, 使用pod install 安装 PedometerLib.framework 非首次使用, 使用pod update 更新 PedometerLib.framework 3. 删除AppDelegate 中的 PedometerLib 引用,及相关代码。 4. 在 ViewController 中 ``` import PedometerLib let ped = PedometerLib() // 获取步数 - complete: (前一天步数,错误信息) ped.getStepCount(complete: (String?, Error?) -> ()) // 步数提交,需要开发者填写 Url、Headers、Uid - Url: api地址 http://xxxx/xx - Headers: { "appId: "xxx", "sigParam": "xxx", "auth": "xxx"} - Uid: "userId":"xxx" - complete:(Api返回的信息, 错误信息) ped.stepCount2Server(Url: String, Headers:[String : String], Uid: String, complete: ([String : AnyObject]?, NSError?) -> ()) ``` 5. 打开App上传步数,需要开发者实现。本SDK提供步数获取、步数上传方法。