swift - Adding an array of HKWorkouts to UserDefaults
问题描述
Is there anyway to add an array of HKWorkouts to UserDefaults or do I have to save the array in core data?
解决方案
HKObject
and its subclasses conform to NSSecureCoding
, so you can convert an array of them to Data
using NSKeyedArchiver
. See the NSKeyedArchiver documentation for more details.
推荐阅读
- google-app-engine - 运行在谷歌应用引擎中安排的应用的最佳做法是什么?
- laravel - Why lumen is not decoding cookies from laravel session correctly.
- java - 使用 Lucene 7.4.0 打印索引词
- android - Android数据绑定在打开其他应用后停止工作
- networking - 域控制器名称中可以使用句点(。)吗?
- c++ - 未使用 STL 向量分配被释放的指针(仅限 OS X)
- swift4 - 搜索过滤器未在集合视图中更新。当我键入一个值 A 时,它的资产在搜索中键入另一个值后显示
- c++ - 使用 Qt 的 RESTful API 请求
- elasticsearch - ElasticSearch 错误请求
- excel - 将 Excel 模板的 VBA 代码插入新工作簿后无法正常工作