Post

Replies

Boosts

Views

Activity

Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1af84999c)
I am trying to create a Multiplatform Document Based app using SwiftUI. I have a List which the user can reorder by dragging Items using .onMove. It works fine in macOS but crashes iOS every time with the above message alongside @main The relevant code is- struct ContentView: View { … List { ForEach(Array(document.journey.items.enumerated()), id: \.1.id) { (index, item) in Section { HStack { Text("\(index+1)") … Text("\(item.address)" … } // End HStack .background( Capsule() .fill((selection.contains(item.id) ? Color.red : Color.blue)) .onTapGesture(perform: { if selection.contains(item.id) { selection.remove(item.id) } else { selection.insert(item.id) } }) ) .font(.headline) .foregroundColor(.white) } // End Section … } // End ForEach .onDelete(perform: delete) .onMove { offsets, toOffset in document.moveItems(offsets: offsets, toOffset: toOffset, undoManager: undoManager) } } // End List //////// final class MultiStopDocument: ReferenceFileDocument { … func moveItems(offsets: IndexSet, toOffset: Int, undoManager: UndoManager? = nil) { let oldItems = journey.items // BREAK POINT print("GOT to First") withAnimation { journey.items.move(fromOffsets: offsets, toOffset: toOffset) } print("GOT to Second") #if os(macOS) undoManager?.registerUndo(withTarget: self) { doc in doc.replaceItems(with: oldItems, undoManager: undoManager) } #endif } /////////// import SwiftUI @main - Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1af84999c) struct MultiStopApp: App { Console macOS stepping :- GOT to First GOT to Second Console iOS stepping :- 2023-06-07 12:03:16.869439+0100 MultiStop[27341:6172177] -[UITextEffectsWindow _accessibilityFindSubviewDescendant:]: unrecognized selector sent to instance 0x112037400 GOT to First 2023-06-07 12:03:52.083774+0100 MultiStop[27341:6172433] XPC connection interrupted GOT to Second THEN CRASH
2
0
2.2k
Jun ’23
macOS, Document based app, saving and loading
I have been doing this a long time but am still not very good at it.I have a document based Mac app that works fine for me and on another Mac but App Store Connect have rejected it now 3 times sayin "We still were unable to review your app as it crashed on launch on Mac running macOS 10.15.3. We have attached detailed crash logs to help troubleshoot this issue." They had another issue but that's not relivant here and I think will be resolved if they ever open the app!They go on to say "For information on how to symbolicate and read a crash log, please review Tech Note TN2151 Understanding and Analyzing Application Crash Reports." as an aside that link takes me to my Agreements, Tax and Banking! However, I have been able to find the document that they are talking about which is for iOS and most of what is suggests I do is not relivant to me it says "Note: Crash reports from macOS are typically symbolicated, or partially symbolicated, at the time they are generated." The fact is that at the top of the backtrace at 0, 1 and 2 are three processes from my app, I can't find a way to identify them other than to follow the flow of my app. When it was first rejected the position 3 on the backtrace was occupied by "NSViewController _sendViewDidLoad" so I moved my functions from View Did Load to View Did Appear. So now the backtrace gets to view did appear and then there are 3 of my functions again at 0-2. I actually don't think that any of that matters because I think I know what is wrong but I can't find, for the life of me, how to fix it.I have a custom Class 'Doc' and in the view controller I have an array of Doc which feeds an NStableview. The tableview is bound to the array and I impliment Drag and Drop also in the view controller using bindings.What I can't do (without App Store Connect saying that it crashes) is save the Doc array in the Document Class and then make use of it. I can save the array and open it again but I think I must be violating MVC which is causing the crash with App Store Connect. I have now created a Class 'Model' which just has a [Doc] in it much along the lines of this sample code https://developer.apple.com/documentation/appkit/documents_data_and_pasteboard/developing_a_document-based_appwhich is just saving a string. The bit I can't do to copy the sample code is bind my representedObject to anything that will make it work. So now I have what is the same array, or trying to be, in the View Controller, the Model Class and the Document Class.I could do with knowing how I save the array and open it again using the Document Class without App Store Connect rejecting it again, it is a very slow way to test your code! Particularly when their links don't work and their documents are not the right ones and they are very old.Thanks to anyone who has got this far and even more thanks to anyone who replies.Francis
1
0
715
May ’20