Post

Replies

Boosts

Views

Activity

Reply to Accessing security scoped URLs without calling url.startAccessingSecurityScopedResource
Thanks very much indeed for your detailed explanation, and I am much clearer now about what is going on. In answer to you question, I have a marine navigation app which has a function "openChart(url)" to open a file stored on the device in a user selected folder, and the function brackets the file opening code with a start/stop. When the user selects a folder, the code loops through the contents and does two things. 1. Uses FileManager to obtain the file size and creation date (bracketed by a start/stop) 2. Calls openChart(url) to extract a title and create a thumbnail So that's 2 start/stop calls per loop, which was actually fine until very recently when a customer selected a folder with 764 files in it. The error appeared after exactly 340 iterations on his device as well as on my iPad pro, and could only be cured by re-starting the app. Saving and loading the bookmark, along with removing the start/stop calls solved the problem, but following your explanation I have implemented the suggestion made by Etresoft and moved the start/stop code to bracket the loop. This also fixes the problem. I haven't so far encountered a need to use an external volume so have not yet encountered bug r.102995804. However, it is a possible use case for my app so I will look into that and report back as you suggest.
Topic: App & System Services SubTopic: Core OS Tags:
1w
Reply to Accessing security scoped URLs without calling url.startAccessingSecurityScopedResource
Thanks for your reply, but I remain confused about this. When I run my code on a real device, the 'Summarise folder without permission' button does NOT work, so there doesn't seem to be any implicit "start". Strangely running the identical code on a simulator DOES work, which I also find confusing. Regarding performance, my interest in this started with sandbox_extension_consume error=[12: Cannot allocate memory] errors occurring when accessing hundreds of URLs, each bracketed by the accessing calls. A single save and retrieve when the user chooses the folder seems not too much hassle compared to this. However, my main concern is that the code doesn't seem to be behaving as expected from the documentation, and I don't understand why!
Topic: App & System Services SubTopic: Core OS Tags:
1w
Reply to sqlite slow performance iOS17 vs. 16 - will it improve in iOS 18
I also have this issue with an enhancement to my app which requires a large file of INSERT statements on initial running and for annual updates. Timings for this on various simulators and devices are shown below. The following timings are for reading a string containing about 150,000 INSERT statements using Swift's sqlite3_exec call: MacBook Pro M3: 0.44s iPhoneSE (3rd generation) Simulator 15.5: 0.52s iPhoneSE (3rd generation) Simulator 16.4: 7.49s iPhoneSE (3rd generation) Simulator 17.4: 323.10s iPad Pro (10.5-inch) 17.5.1 Device 1165.31s iPhone SE 18.0 (beta) Device 0.69s The issue does seem to have been fixed for iOS 18, but it remains a deal-breaker for iOS 17. Can anyone suggest a workaround? Bill Aylward
Jul ’24
Reply to How to determine that NWBrowser has finished?
Thanks Quinn, that's very helpful. My application does a one-off search for SignalK servers at the start of a session. The user then selects one of them and sticks with it. If there are NO servers on the network, then I wanted to present that information to the user. In practice, if the code has not discovered any after a few seconds, then I think its safe to say the search has finished (even if the browser is still running)
Jun ’24
Reply to Struct with an 'expiry date' - how to create elegantly?
I've read much more about Combine now, and I think it's not possible to put this functionality into the struct itself. However, it CAN be put into a view model like this: class MarineDatumViewModel: ObservableObject { @Published var marineDatum: MarineDatum = MarineDatum(value: 0.0) { didSet { if marineDatum.isNew { DispatchQueue.main.asyncAfter(deadline: .now() + 2) { self.marineDatum.makeOld() } } } } }
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23
Reply to SwiftUI - ForEach in List shows the wrong row in detail with iOS 15 but the right one in iOS 14
A workaround is to add an additional State variable to hold the selected item, like this: let items = ["One", "Two", "Three"] @State private var showAlert: Bool = false @State private var selectedItem: String = ""     var body: some View { List { ForEach(items, id: \.self) { item in Text(item) .onTapGesture() { selectedItem = item showAlert = true } .alert(isPresented: $showAlert, content: { Alert(title: Text(selectedItem), message: Text(selectedItem), dismissButton: .default(Text("OK"))) }) } }     }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21