小编Fro*_*ner的帖子

更新至 Xcode 13,尝试在 iOS(而非 macOS)上运行 SwiftUI 应用程序时获取独特的错误代码

当我尝试构建我的应用程序时,我收到以下错误:

无法找到适用于 iOS 平台和用途开发的配置文件类型。您可能需要重新安装 Xcode。

我立即这样做了,但这并没有解决问题。清理构建文件夹、重新启动、重新启动等也不起作用。以前有人遇到过这种情况吗?

xcode ios swiftui

11
推荐指数
3
解决办法
6440
查看次数

CoreData + CloudKit 将 CKShare 恢复到 CoreData 存储

我使用 NSPersistentCloudKitContainer 将对象保存在 CoreData + CloudKit 中。我集成了一个共享功能,可将对象移动到单独的区域以使用 UICloudSharingController 进行共享,如中所述https://developer.apple.com/wwdc21/10015

当用户停止共享时,我希望删除共享区域中的对象,并将其移回CoreData + CloudKit标准私有区域。使用以下方法删除 CKShare 及其区域:

/**
 Delete the Core Data objects and the records in the CloudKit record zone associcated with the share.
 */
func purgeObjectsAndRecords(with share: CKShare, in persistentStore: NSPersistentStore? = nil) {
    guard let store = (persistentStore ?? share.persistentStore) else {
        print("\(#function): Failed to find the persistent store for share. \(share))")
        return
    }
  
    persistentContainer.purgeObjectsAndRecordsInZone(with: share.recordID.zoneID, in: store) { (zoneID, error) in
        if let error = error {
            print("\(#function): …
Run Code Online (Sandbox Code Playgroud)

cloudkit swiftui nspersistentcloudkitcontainer

5
推荐指数
1
解决办法
858
查看次数