Hi!I am developing an app (in XCode Version 11.2 and Swift 4.2) in which I fill in a LinkedList and after working with it, removing the elements that compose it produces the Thread 1 error: EXC_BAD_ACCESS (code = 2, address = 0x16d0f3ff0). The error occurs even without working with the items in the list, simply by adding them and trying to eliminate them the error already occurs. The tests I am doing with an iPhone with IOS version 11.4.1The method that eliminates the elements of the LinkedList is removeAll.The error occurs in the first line:public func removeAll() { self.head = nil //Thread 1: EXC_BAD_ACCESS (code=2, address=0x16d0f3ff0) self.tail = nil self.count = 0} // removeAllthe definition of the variables 'head', 'tail', 'count': private var head: Node<T>? private var tail: Node<T>? public private(set) var count: Int = 0And the type Node<T>:public class Node<T> { var value: T var next: Node<T>? weak var previous: Node<T>? init(value: T) { self.value = value } // init} // NodeWith the debugger I see that the error occurs when assigning the value nil to self.head (in removeAll()). Just before self.head has correct values, it becomes nil and the error is skipped before reaching the next instruction.In the Debug Navigator, in the stackTrace the last 2 functions where the error is seen:libobjc.A.dylib`_object_remove_assocations: 0x180d11eec <+0>: sub sp, sp, #0x70 ; =0x70 -> 0x180d11ef0 <+4>: stp x26, x25, [sp, #0x20] //Thread 1 error: EXC_BAD_ACCESS (code = 2, address = 0x16d0f3ff0) 0x180d11ef4 <+8>: stp x24, x23, [sp, #0x30]libswiftCore.dylib`_swift_release_: 0x104e18d1c <+180>: bl 0x104e1a37c ; bool swift::RefCounts<swift::SideTableRefCountBits>::doDecrement<(swift::PerformDeinit)1>(unsigned int)-> 0x104e18d20 <+184>: ldp x29, x30, [sp], #0x10. //Thread 1 error: EXC_BAD_ACCESS (code = 2, address = 0x16d0f3ff0) 0x104e18d24 <+188>: retDoes someone have idea how to resolve it?Thanks!
Post
Replies
Boosts
Views
Activity
Hi!In MKMapView it is possible to hide the name of the seas or oceans? Due to international conflicts I am interested in not seeing their name.Thanks
Hi!The first thing, to say that all this works correctly debugging with XCode (Swift 4.2), the problem comes when uploading it to the AppStore that gives an error in the DispatchQueue, but I don't know how to see at what point it happens, seeing the log I can only see what happens in the DispatchQueue. This is what the log says, but they are all directions that I do not know how to interpret:Thread 2 name: Dispatch queue: firmwareQueue Thread 2 Crashed: ..... 0 myapp 0x00.......... 1 libdispatch.dylib 0x00.......... 2 libdispatch.dylib 0x00.......... 3 libswiftCore.dylib 0x00.......... 4 myapp 0x00.......... 5 myapp 0x00.......... ...In my program:.....let appDelegate = UIApplication.shared.delegate as! AppDelegatelet progress = ProgressDialog(delegate: appDelegate.viewControllerActive!)progress.Show(animate: true, message: "Updating…") // NOT SHOWINGlet firmwareQueue = DispatchQueue(label:"firmwareQueue"); firmwareQueue.async { self.update_firmware(progress: progress) { ..... }}.....In the function 'update_firmware' it connects via BT with a device and once the connection is established a series of messages are exchanged. In this exchange of messages, a counter is kept to see what is missing from the process and is shown to the user through a progress screen. Progress should be displayed in the ProgressDialog, this is the code inside the update_firmware function to show it:..... DispatchQueue.main.async { self.progress!.SetText(message: "Updating device…") self.progress!.SetProgressTotal(progress: Float(totalBlockCount)) self.progress!.SetShowProgressbar(show: true); }....Although the progress dialog is not displayed before starting to communicate with the device, it does communicate with it and exchange some messages (I see it on the device before the program crashes).Does anyone have any idea how I can see the point where it happens? Or if something similar has happened to someone?Thanks