Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在构建一个应用程序来保存俯卧撑锻炼。我需要创建一个 HKWorkout 变量,但所有构造函数都需要距离。我的锻炼不包括距离。我该怎么处理这个变量?还有其他构造函数吗?
谢谢
nil如果您的锻炼不包括行驶距离,只需传递距离数量即可。
nil
您可以HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierStepCount)在请求 HealthKit 授权时尝试。假设您要让 Apple Watch 计算俯卧撑的数量,这是当前最接近的健康工具包定义。
HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierStepCount)