首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏肘子的Swift记事本

    在 SwiftUI 下使用 NSUbiquitousKeyValueStore 同步数据

    在 SwiftUI 下使用 NSUbiquitousKeyValueStore 同步数据 可以访问我的博客 www.fatbobman.com[1] ,获得更好的阅读体验 NSUbiquitousKeyValueStore 什么是 NSUbiquitousKeyValueStore NSUbiquitousKeyValueStore 可以理解为 UserDefaults 的网络同步版本。 (forKey: "count") 默认值为 0 •NSUbiquitousKeyValueStore 有更多的限制苹果并不推荐使用 NSUbiquitousKeyValueStore 保存数据量大、变化频繁且对 尽管 NSUbiquitousKeyValueStore 没有提供数据同步的原子支持,但在绝大多数情况下,NSUbiquitousKeyValueStore 会尽量保证在用户切换 iCloud 账户、重新登录 NSUbiquitousKeyValueStore 的基本工作流程如下: •将键值对保存到 NSUbiquitousKeyValueStore 中•NSUbiquitousKeyValueStore 首先将键值数据保存在内存中

    5.6K40编辑于 2022-07-28
  • 来自专栏肘子的Swift记事本

    为 @CloudStorage 添加了类 @Published 的能力

    我重新修改了 CloudStorage 的代码,现在可以同 AppStorage 完全一样将 UserDefaults 和 NSUbiquitousKeyValueStore 汇总到一起,在 SwiftUI 关于 NSUbiquitousKeyValueStore 请参阅 在 SwiftUI 下使用 NSUbiquitousKeyValueStore 同步数据[2] 关于 AppStorage 可以阅读 @ 参考资料 [1] Fork 版本: https://github.com/fatbobman/CloudStorage [2] 在 SwiftUI 下使用 NSUbiquitousKeyValueStore 同步数据: https://www.fatbobman.com/posts/nsubiquitousKeyvalueStore/ [3] @AppStorage 研究: https://fatbobman.com

    78720编辑于 2022-07-28
  • 来自专栏coding...

    iOS开发-RAC+MVVM练手项目 图床App写在前面准备工作界面设计首页历史关于后记

    homeDict= homeModel.yy_modelToJSONObject; NSLog(@"homeDict=%@",homeDict); //iCloud存储 NSUbiquitousKeyValueStore *myKeyValue = [NSUbiquitousKeyValueStore defaultStore]; NSArray *iCloudData = [myKeyValue objectForKey *myKeyValue = [NSUbiquitousKeyValueStore defaultStore]; NSArray *iCloudData = [myKeyValue objectForKey } return _deleteCommand; } - (void)deleteData:(NSDictionary*)data { //从iCloud中获取数据 NSUbiquitousKeyValueStore *myKeyValue = [NSUbiquitousKeyValueStore defaultStore]; NSArray *iCloudData = [myKeyValue objectForKey

    1.2K20发布于 2018-08-23
  • 来自专栏肘子的Swift记事本

    为自定义属性包装类型添加类 @Published 的能力

    MyPublished( @Published 的仿制版本 )、@PublishedObject(包装值为引用类型的 @Published 版本)、@CloudStorage(类似 @AppStorage ,但适用于 NSUbiquitousKeyValueStore AppStorage("age") public var age = 12 } Tom Lokhorst 写了一个类似 @AppStorage 的第三方库 —— @CloudStorage ,实现了在 NSUbiquitousKeyValueStore 在撰写 在 SwiftUI 下使用 NSUbiquitousKeyValueStore 同步数据[9] 一文的时候,我尚未掌握本文介绍的方法。 BlogCodes/tree/main/Published [8] @AppStorage 研究: https://fatbobman.com/posts/appstorage/ [9] 在 SwiftUI 下使用 NSUbiquitousKeyValueStore 同步数据: https://www.fatbobman.com/posts/nsubiquitousKeyvalueStore/ [10] 修改后的 Fork 版本: https://github.com

    4.4K20编辑于 2022-07-28
  • 来自专栏Swift社区

    Swift 中 User Defaults 的读取和写入

    用于跨平台的 CloudKit 如果希望首选项可以从安装了你的应用程序的其他 Apple 设备访问,请考虑使用 NSUbiquitousKeyValueStore

    1.1K20编辑于 2023-11-03
  • 来自专栏肘子的Swift记事本

    注册 WWDC 2025 的 Group Labs 了没? | 肘子的 Swift 周报 #085

    ObservableDefaults - 让持久化数据优雅地融入 SwiftUI[21] ObservableDefaults是我创建的一个 Swift 库,提供两个实用的宏,用于将 UserDefaults和 NSUbiquitousKeyValueStore

    57400编辑于 2025-05-27
  • 来自专栏肘子的Swift记事本

    肘子的 Swift 周报 #027 | 苹果助你成为一日“百万富翁”

    为了简化开发者的工作,苹果在 2023 年的 WWDC 中推出了 CKSyncEngine[18] 框架,并已在其应用如 Freeform 和 NSUbiquitousKeyValueStore 中采用

    77410编辑于 2024-04-18
  • 来自专栏肘子的Swift记事本

    Core Data with CloudKit(四)—— 调试、测试、迁移及其他

    3.或许可考虑通过使用NSUbiquitousKeyValueStore进行判断。 2、3两种方式都需要保证网络及账号状态正常的情况下才能检查,让用户自行判断或许最为简单。

    1.4K30编辑于 2022-07-28
  • 来自专栏肘子的Swift记事本

    iCloud Documents 详解:基础设置与文件操作

    写在前面的话 苹果基于 CloudKit 为开发者提供了三个主要的功能:CloudKit(保存结构化数据)、NSUbiquitousKeyValueStore(保存键值数据)以及 iCloud Documents

    1.9K10编辑于 2023-12-13
  • 来自专栏逆向与安全

    某IOS可信ID产品原理分析

    objc_release(v194); objc_release(v195); if ( v194 ) { v135 = objc_msgSend(&OBJC_CLASS___NSUbiquitousKeyValueStore

    2.2K40发布于 2020-10-29
领券