Post

Replies

Boosts

Views

Activity

Reply to Why does clean C++ sandbox app crash before reaching main?
Thank you. Afraid the error must have been between keyboard and chair. I got the error on an existing, older project. Then I created a new, clean C++ project and it did the same. Not sure what I managed to do to enable sandbox for a console app, but I thought it was the default setting, hence the question. I just tried reproducing it again just now, and could not. When I created a new app, I got the clean "Hallo World". So seems it was just an error on my side. At least I learned something - thank you for that.
Topic: Code Signing SubTopic: General Tags:
Jan ’23
Reply to Can corrupt Xcode project explain broken intellisense?
I dug a bit deeper and found more info. It does not seem to be a corrupt Xcode project, but a setting in the top level project. I found that the issue is caused with Header Search Paths. We unfortunately have one or two places where there are file name clashes. To get around this, we set Use Header Maps to No and each target has the correct Header Search Paths to find the correct file. It turns out that this is causing the issue. Attached is an image of a very simple project (cannot attach project) to demonstrate the issue. The image should make it pretty clear on how to reproduce the project. The project contains two targets. The SearchPathIssue Intellisense Working target has Use Header Maps set to Yes (default) while SearchPathIssue Intellisense Broken has it set to No and has a Header Search Path to correctly find the headers. If the search path is not given, then the project does not build. If you open main.cpp you can type "shape." to see the code completions. It works when the target SearchPathIssue Intellisense Working is selected and it does not work when SearchPathIssue Intellisense Broken is selected. I do not have a work-around for the issue yet. Maybe someone does? I've raised a bug using Feedback Assistant and will post here if I get a reply.
Jun ’23
Reply to Protocol availability inconsistencies related to modern serial layers
How (where) is the best place to push for this functionality? I know it was always possible with lightning (hardware wise) but the move to USB-C opened up so many easy, low-hanging-fruit possibilities. I can plug in my standard USB-thumb drive into my iPhone and share files; I can plug in my existing USB-C to Ethernet and use Ethernet; I can even plug in my smart monitor. As a developer (hardware and software) it would be awesome to plug and access standard HID and serial (like FTDI) devices. Test jigs, test stations, etc. can suddenly use iPhones instead of PCs.
Topic: App & System Services SubTopic: Core OS Tags:
Oct ’23
Reply to Using TextField:text:selection crashes on macOS
Follow-up, but related question. I expanded my demo, playing with TextField(text:selection) to understand it and found that the selection changes before the text does. Below is my expanded file. I tried to print the selection underneith the TextField but this code crashes. I've added print statements to debug and found that the selection is not valid for the value of text when I call toString. Is this normal? I found that using the onChange event on the selection works correctly but I see this as a workaround. It means there is currently no way to just print the selection (current state) with the corresponding text (same state) in the view, or am I missing something? struct ContentView: View { @State private var selection: TextSelection? @State private var text: String = "" var body: some View { VStack { TextField("Message", text: $text, selection: $selection) // .onChange(of: selection) { // if let selection = selection.take() { // if case let .selection(range) = selection.indices { // print("Selection in \(text): \(toString(selection: selection))") // print("Selected text: '\(text[range])'") // } // } // } Text("Selection in \(text): \(toString(selection: selection))") } .padding() } func toString(selection: TextSelection?) -> String { guard let selection else { return "None" } print("Printing indices in '\(text)'") switch selection.indices { case .selection(let range): let lower = range.lowerBound.utf16Offset(in: text) let upper = range.upperBound.utf16Offset(in: text) return "\(lower) - \(upper)" case .multiSelection(let rangeSet): return "Multi selection \(rangeSet)" @unknown default: fatalError("Unknown selection") } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’24
Reply to Why is AVAudioEngine input giving all zero samples?
Hi Greg, Thank you very much. Knowing that the code is not the issue gave me enough to resolve the issue. It is a macOS Sandbox app and Audio Input was not checked. The app now also stopped asking me for permission every time when it runs. I still get the following warnings traced when the app runs. It seems to have no effect. Can I safely ignore it? AddInstanceForFactory: No factory registered for id <CFUUID 0x600002d100e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46 HALC_ProxyObjectMap.cpp:173 HALC_ProxyObjectMap::_CopyObjectByObjectID: failed to create the local object HALC_ShellDevice.cpp:2670 HALC_ShellDevice::RebuildControlList: couldn't find the control object throwing -10877 throwing -10877 86275 HALC_ProxyIOContext.cpp:1073 HALC_ProxyIOContext::_StartIO(): Start failed - StartAndWaitForState returned error 35 86275 HALC_ProxyIOContext.cpp:1073 HALC_ProxyIOContext::_StartIO(): Start failed - StartAndWaitForState returned error 35 86275 HALC_ProxyIOContext.cpp:1073 HALC_ProxyIOContext::_StartIO(): Start failed - StartAndWaitForState returned error 35 HALB_IOThread.cpp:326 HALB_IOThread::_Start: there already is a thread
Topic: Media Technologies SubTopic: Audio Tags:
Dec ’24
Reply to SwiftUI TextField corrupts selection when inserting utf16
Thank you for the reply. That is strange. I consistently get the error. I am running macOS 15.4.1 (24E263). I've updated the body variable in my original example to print out all the changes (see further below, from line 7). With this change, I get the following output: input: changed from '' to '1' input: changed from '1' to '12' Moving cursor from 2[any] Moved to 4[utf8] input: changed from '12' to '12×' input: changed from '12×' to '12×3' input: changed from '12×3' to '12×43' Note line 3&4 where it replaced '*' with 'x'. When I then continue to type '3' and '4' you can see the output changes to "43" instead of "34". Your log showed the cursor moving twice. Did you use the arrow keys for this? I only have the cursor moving once for the one replacement. var body: some View { VStack { TextField("Type 12*34", text: $input, selection: $selection) .onKeyPress(action: {keyPress in handleKeyPress(keyPress) }) .onChange(of: input) { oldValue, newValue in print("input: changed from '\(oldValue)' to '\(newValue)'") } Text("Selection: \(selectionAsString())") }.padding() }
Topic: UI Frameworks SubTopic: SwiftUI
May ’25
Reply to SwiftUI TextField corrupts selection when inserting utf16
I tried my code in MacOS 26.0 Beta (25A5279m). The problem is not there, so it seems to be a bug in 15.5. Although this specific issue is fixed in 26.0, it is introducing new ones. The index in the string is clearly being corrupted. I suspect it still has to do between the switch of index between utf8 and utf16. When I type 1234, then press cursor back once, so that curser is between 3 and 4, and type '' three times then I suddenly get '12×3×à 4'. I can see from my log that the input is completely corrupted: input: changed from '' to '1' input: changed from '1' to '12' Moving cursor from 2[any] Moved to 4[utf8] input: changed from '12' to '12×' input: changed from '12×' to '12×3' input: changed from '12×3' to '12×34' Moving cursor from 4[utf16] Moved to 7[utf8] input: changed from '12×34' to '12×3×4' Moving cursor from 7[utf8] Moved to 8[utf8] input: changed from '12×3×4' to '12×3××4' Moving cursor from 8[utf8] Moved to 9[utf8] input: changed from '12×3××4' to '12×3×\303×\2274' code-block It seems that the text selection in TextField is not great yet. I wanted to raise a developer support but it said that apple engineers will prioritise forums during this time. Hopefully someone can take a look at this. I also tried changing from String to AttributedString to test the new TextField with formatting but this does not seem to be available yet.
Topic: UI Frameworks SubTopic: SwiftUI
Jun ’25
Reply to Why does clean C++ sandbox app crash before reaching main?
Thank you. Afraid the error must have been between keyboard and chair. I got the error on an existing, older project. Then I created a new, clean C++ project and it did the same. Not sure what I managed to do to enable sandbox for a console app, but I thought it was the default setting, hence the question. I just tried reproducing it again just now, and could not. When I created a new app, I got the clean "Hallo World". So seems it was just an error on my side. At least I learned something - thank you for that.
Topic: Code Signing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’23
Reply to Can corrupt Xcode project explain broken intellisense?
I dug a bit deeper and found more info. It does not seem to be a corrupt Xcode project, but a setting in the top level project. I found that the issue is caused with Header Search Paths. We unfortunately have one or two places where there are file name clashes. To get around this, we set Use Header Maps to No and each target has the correct Header Search Paths to find the correct file. It turns out that this is causing the issue. Attached is an image of a very simple project (cannot attach project) to demonstrate the issue. The image should make it pretty clear on how to reproduce the project. The project contains two targets. The SearchPathIssue Intellisense Working target has Use Header Maps set to Yes (default) while SearchPathIssue Intellisense Broken has it set to No and has a Header Search Path to correctly find the headers. If the search path is not given, then the project does not build. If you open main.cpp you can type "shape." to see the code completions. It works when the target SearchPathIssue Intellisense Working is selected and it does not work when SearchPathIssue Intellisense Broken is selected. I do not have a work-around for the issue yet. Maybe someone does? I've raised a bug using Feedback Assistant and will post here if I get a reply.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Protocol availability inconsistencies related to modern serial layers
How (where) is the best place to push for this functionality? I know it was always possible with lightning (hardware wise) but the move to USB-C opened up so many easy, low-hanging-fruit possibilities. I can plug in my standard USB-thumb drive into my iPhone and share files; I can plug in my existing USB-C to Ethernet and use Ethernet; I can even plug in my smart monitor. As a developer (hardware and software) it would be awesome to plug and access standard HID and serial (like FTDI) devices. Test jigs, test stations, etc. can suddenly use iPhones instead of PCs.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Using TextField:text:selection crashes on macOS
Follow-up, but related question. I expanded my demo, playing with TextField(text:selection) to understand it and found that the selection changes before the text does. Below is my expanded file. I tried to print the selection underneith the TextField but this code crashes. I've added print statements to debug and found that the selection is not valid for the value of text when I call toString. Is this normal? I found that using the onChange event on the selection works correctly but I see this as a workaround. It means there is currently no way to just print the selection (current state) with the corresponding text (same state) in the view, or am I missing something? struct ContentView: View { @State private var selection: TextSelection? @State private var text: String = "" var body: some View { VStack { TextField("Message", text: $text, selection: $selection) // .onChange(of: selection) { // if let selection = selection.take() { // if case let .selection(range) = selection.indices { // print("Selection in \(text): \(toString(selection: selection))") // print("Selected text: '\(text[range])'") // } // } // } Text("Selection in \(text): \(toString(selection: selection))") } .padding() } func toString(selection: TextSelection?) -> String { guard let selection else { return "None" } print("Printing indices in '\(text)'") switch selection.indices { case .selection(let range): let lower = range.lowerBound.utf16Offset(in: text) let upper = range.upperBound.utf16Offset(in: text) return "\(lower) - \(upper)" case .multiSelection(let rangeSet): return "Multi selection \(rangeSet)" @unknown default: fatalError("Unknown selection") } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Why is AVAudioEngine input giving all zero samples?
Hi Greg, Thank you very much. Knowing that the code is not the issue gave me enough to resolve the issue. It is a macOS Sandbox app and Audio Input was not checked. The app now also stopped asking me for permission every time when it runs. I still get the following warnings traced when the app runs. It seems to have no effect. Can I safely ignore it? AddInstanceForFactory: No factory registered for id <CFUUID 0x600002d100e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46 HALC_ProxyObjectMap.cpp:173 HALC_ProxyObjectMap::_CopyObjectByObjectID: failed to create the local object HALC_ShellDevice.cpp:2670 HALC_ShellDevice::RebuildControlList: couldn't find the control object throwing -10877 throwing -10877 86275 HALC_ProxyIOContext.cpp:1073 HALC_ProxyIOContext::_StartIO(): Start failed - StartAndWaitForState returned error 35 86275 HALC_ProxyIOContext.cpp:1073 HALC_ProxyIOContext::_StartIO(): Start failed - StartAndWaitForState returned error 35 86275 HALC_ProxyIOContext.cpp:1073 HALC_ProxyIOContext::_StartIO(): Start failed - StartAndWaitForState returned error 35 HALB_IOThread.cpp:326 HALB_IOThread::_Start: there already is a thread
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Why is AVAudioEngine input giving all zero samples?
Thank you Greg. That was useful information regarding the log noise. Good to know.
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Jan ’25
Reply to SwiftUI TextField corrupts selection when inserting utf16
Thank you for the reply. That is strange. I consistently get the error. I am running macOS 15.4.1 (24E263). I've updated the body variable in my original example to print out all the changes (see further below, from line 7). With this change, I get the following output: input: changed from '' to '1' input: changed from '1' to '12' Moving cursor from 2[any] Moved to 4[utf8] input: changed from '12' to '12×' input: changed from '12×' to '12×3' input: changed from '12×3' to '12×43' Note line 3&4 where it replaced '*' with 'x'. When I then continue to type '3' and '4' you can see the output changes to "43" instead of "34". Your log showed the cursor moving twice. Did you use the arrow keys for this? I only have the cursor moving once for the one replacement. var body: some View { VStack { TextField("Type 12*34", text: $input, selection: $selection) .onKeyPress(action: {keyPress in handleKeyPress(keyPress) }) .onChange(of: input) { oldValue, newValue in print("input: changed from '\(oldValue)' to '\(newValue)'") } Text("Selection: \(selectionAsString())") }.padding() }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
May ’25
Reply to SwiftUI TextField corrupts selection when inserting utf16
Hi Claude31, Have you been able to reproduce my problem with more info given below? Is it possible that the error is only in a certain version of macOS, or am I doing something else wrong?
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Jun ’25
Reply to SwiftUI TextField corrupts selection when inserting utf16
I tried my code in MacOS 26.0 Beta (25A5279m). The problem is not there, so it seems to be a bug in 15.5. Although this specific issue is fixed in 26.0, it is introducing new ones. The index in the string is clearly being corrupted. I suspect it still has to do between the switch of index between utf8 and utf16. When I type 1234, then press cursor back once, so that curser is between 3 and 4, and type '' three times then I suddenly get '12×3×à 4'. I can see from my log that the input is completely corrupted: input: changed from '' to '1' input: changed from '1' to '12' Moving cursor from 2[any] Moved to 4[utf8] input: changed from '12' to '12×' input: changed from '12×' to '12×3' input: changed from '12×3' to '12×34' Moving cursor from 4[utf16] Moved to 7[utf8] input: changed from '12×34' to '12×3×4' Moving cursor from 7[utf8] Moved to 8[utf8] input: changed from '12×3×4' to '12×3××4' Moving cursor from 8[utf8] Moved to 9[utf8] input: changed from '12×3××4' to '12×3×\303×\2274' code-block It seems that the text selection in TextField is not great yet. I wanted to raise a developer support but it said that apple engineers will prioritise forums during this time. Hopefully someone can take a look at this. I also tried changing from String to AttributedString to test the new TextField with formatting but this does not seem to be available yet.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Jun ’25
Reply to SwiftUI TextField corrupts selection when inserting utf16
This issue is now fixed in macOS Tahoe (26.0 (25A353))
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Sep ’25