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:
Jul ’25
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:
Jul ’25
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 Menu presentation in UIHostingController issues
I am getting the same error with a new Xcode (26.1.1) iOS app project and a very simple menu: var body: some View { VStack { Menu("Options") { Button("One", action: {} ) } } } } The error occurs both on tapping "Options" and "One"
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’25
Reply to Accessing security scoped URLs without calling url.startAccessingSecurityScopedResource
Many thanks Kevin, Calling start/stop on the enclosing directory also fixes the issue.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’25
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:
Replies
Boosts
Views
Activity
Jul ’25
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:
Replies
Boosts
Views
Activity
Jul ’25
Reply to SwiftUI Popover Crash During Resizing in Stage Manager
As a workaround, I have found that closing the popover on scene change stops the crash: @Environment(\.scenePhase) var scenePhase HStack { ... } .onChange(of: scenePhase) { newPhase in if newPhase == .background { showPopover = false } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Package platforms not working
Doh! That's fixed it - Thanks Ed
Replies
Boosts
Views
Activity
Dec ’24
Reply to sqlite slow performance iOS17 vs. 16 - will it improve in iOS 18
I have found a workaround for my own app (which uses my own lightweight framework around the SQLite c/c++ api). The package referenced below complies the latest version of SQLite into my code. It was very easy to implement and so far seems to have fixed the issue. https://github.com/sbooth/CSQLite.git Thank you Stephen Booth. Bill Aylward
Replies
Boosts
Views
Activity
Jul ’24
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
Replies
Boosts
Views
Activity
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)
Replies
Boosts
Views
Activity
Jun ’24
Reply to A user is unable to download content in app
Thank you Quinn, that's a helpful way forward Bill
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’24
Reply to Intermittent error on newly purchased app
Interesting - this sounds just like the problem I posted just now ("A user is unable to download content in app")
Replies
Boosts
Views
Activity
Apr ’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:
Replies
Boosts
Views
Activity
Jun ’23
Reply to 2 problems with FileImporter and FileExporter modifier
I experience the same issue with the .fileExporter, though it does not seem to affect the function of the modifier. The code is more than 12 months old, but the error message is new suggesting some change in iOS or Xcode over the last year has introduced this.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Assign a protocol compliant type programatically
Understood, that's a clever use of a dictionary. Thanks - that solves my issue
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’23
Reply to Assign a protocol compliant type programatically
Thanks for your reply. The structs are read from a file, so the array can't be populated statically. I could use classes instead, but wouldn't I still need a switch to choose the appropriate subclass?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’22