Post

Replies

Boosts

Views

Activity

Core Data won't save external storage blob on iOS 15
I am getting the following error when trying to save a Core Data entity on iOS 15 for a Binary Data property that's marked as Allows External Storage. NSDestinationFilePath=/private/var/mobile/Containers/Data/Application/84AF234B-E720-4DD5-96F5-4D9FE9EC374C/tmp/.LINKS/6BD575C1-FF6F-4F7E-A3A5-DF334B4219F8/F0FFA46B-6A17-4783-8935-8EF20509B990_0x2825aea80, NSFilePath=/private/var/mobile/Containers/Data/Application/84AF234B-E720-4DD5-96F5-4D9FE9EC374C/Documents/Test Photos.tapforms/db-ebd84a251706462fb4df5308b3cbdd1c.cd/.tf6_SUPPORT/_EXTERNAL_DATA/F0FFA46B-6A17-4783-8935-8EF20509B990.interim, NSUnderlyingError=0x2816b9bf0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} So it would seem perhaps that Core Data is writing an interim file probably in an atomic way and may be trying to rename it afterwards. But it's not finding the .interim file and is throwing this error. Does anyone know a solution to this problem? Thanks, Brendan
1
0
977
Jul ’21
SwiftUI sidebar within NSHostedView on macOS doesn't show selections
I have an AppKit app written mostly in Objective-C. I'm trying to convert my NSOutlineView to a SwiftUI OutlineGroup. Right now I'm just using List{} because I can't get OutlineGroup to work with CoreData. But when I display my list of items in the sidebar, I can't select any items. I can click on them of course, but the row selection highlighting doesn't work at all. I think maybe this might have something to do with the fact that my SwiftUI view is embedded within an NSHostingView. I've setup my NSHostingView like this: import Cocoa import SwiftUI @objc class FormsListHostingController: NSViewController { public var viewModel : FormsListUIView.ViewModel? var formsListView : FormsListUIView? @objc public var databaseDocument : TFDatabaseDocument? override func viewDidLoad() {         super.viewDidLoad() var hostingView : NSHostingView<FormsListUIView>? if let context = self.databaseDocument?.dataAccessManager?.persistentContainer.viewContext { let viewModel = FormsListUIView.ViewModel(managedObjectContext: context) let contentView : FormsListUIView = FormsListUIView(viewModel: viewModel) hostingView = NSHostingView(rootView: contentView) self.view = hostingView! } } } and my SwiftUI view is setup like this: struct FormsListUIView: View { @Environment(\.managedObjectContext) var context @ObservedObject var viewModel: ViewModel @State private var selection: CDForm? = nil @State private var isSelected : Bool = false var body: some View { List(selection: self.$selection) { ForEach(viewModel.categories, id: \.uuid) { (category : CDCategory) in Section(header: Text(category.name ?? "").font(.headline)) { ForEach(Array(category.forms as! Set<CDForm>), id: \.uuid) { (form : CDForm) in FormRow(form: form).onTapGesture { self.selection = form isSelected.toggle() } } } } } .listStyle(SidebarListStyle()) .frame(maxWidth: .infinity, maxHeight: .infinity) } } Any ideas why the row selection doesn't show? I'm suspecting it's a problem with showing a SwiftUI view within an NSHostingView.
1
0
857
Jul ’20