Post

Replies

Boosts

Views

Activity

Reply to How to use SWIFTUI and SWIFT language to call com port?
I don't know if this is still an issue for you but you have the choice of calling C, Objective-C, and now C++ directly from Swift. See what's new in Swift from WWDC23. There is a sample here that will allow you to enumerate serial devices on macOS. That might be a useful place to start. I would place this code in a separate framework and write the appropriate wrapper functions (as needed) to invoke them from SwiftUI or Swift. If you are trying this on iPadOS, forget it. The sample code won't compile for iOS since most of the definitions are missing or not made public for serial device support in IOKit. I was able to test this code with an FT232(USB-C to UART) board and it worked well enough. Also, you can use Serial Tools to make sure the device you want to talk to is supported by the default drivers built into macOS.
Topic: App & System Services SubTopic: Drivers Tags:
Dec ’23
Reply to How to use Swift and AVFoundation to stream/record USB microphone input?
Trial & error coupled with scouring the web has yielded at least a partial answer: import AVFoundation import Cocoa import PlaygroundSupport PlaygroundPage.current.needsIndefiniteExecution = true let engine = AVAudioEngine() let inputNode = engine.inputNode let format = inputNode.inputFormat(forBus: 0) let outputNode = engine.outputNode engine.connect(inputNode, to: outputNode, format: format) //var bufferCount = 0 //input.installTap(onBus: 0, bufferSize: 2048, format: nil) { audioBuffer, audioTime in // bufferCount += 1 // print(bufferCount) //} engine.prepare() do { try engine.start() } catch { print(error) } Ridiculously simple but amazingly difficult to stumble upon. At least, that was my experience. Next, I need a way to enumerate the inputs so I can pick the microphone I want to use. Anyone have a clue on how that is accomplished on macOS? During my time researching this problem, I noticed that things are much easier and much better documented for iOS.
Topic: Media Technologies SubTopic: Audio Tags:
Jan ’24
Reply to Settings bundle for DEXT loading app does not display content.
Ignore the API call I listed in the initial post. That is for macOS not iPadOS. I actually support both platforms but the issue I'm having is with the iPad. There we simply launch the settings app using the following technique: extension ExtensionManager { func activate() { guard let url = URL(string: UIApplication.openSettingsURLString) else { return } UIApplication.shared.open(url) } func deactivate() { } }
Topic: App & System Services SubTopic: Drivers Tags:
Mar ’24
Reply to Lack of Vendor ID for “USB transport" entitlement and Can't find "userclient-access" for AppID
I have the same question with regard to the USB transport entitlement. I've added my vendor id to the appropriate entitlement files but my binary fails validation when trying to upload it to the store for distribution. The embeded.mobileprovision file in the generated archive shows an asterisk instead of my approved Vendor ID. How can I make sure the embedded provisioning file has my Vendor ID?
Topic: Code Signing SubTopic: General Tags:
May ’24
Reply to DriverKit: embedded.mobileprofile has the wildcard USB Vendor ID instead of my assigned Vendor ID
Kevin, thank you so much for responding. My entire dev team just got together on a video call and spent 3 hours trying everything we could to figure this out. No personal reflection on you but Apple MUST do better. The information you provided above jives with most of what we discovered. The solution for us was to switch to automatic and also change the idVendor value from a String to a Number when moving from an wildcard value to a literal value. This appears to be necessary when putting a real Vendor ID in the entitlements file. This was a lot harder than it should have been.
May ’24
Reply to How to I cancel a task created by the new Swift `async` keyword and closure, after the fact?
Note that this class is decorated with @MainActor which was somehow dropped in the cut & paste.
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to How to I cancel a task created by the new Swift `async` keyword and closure, after the fact?
The code I commented out doesn't work because Task. was missing. You provided the solution. Thank you. Anyone know how to mark a topic or thread as closed?
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to How to I cancel a task created by the new Swift `async` keyword and closure, after the fact?
The solution was provided by "_Agent". I was missing the full type name task handle. A case of mental blindness.
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to DriverKit driver doesn't appear in Settings when installed with iPad app
I also have the same issue. Did the entitlement from Apple solve the problem?
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Subclassing from IOUserUSBSerial
@svedm How do you link against USBSerialDriverKit.framework? Using Xcode 15, I can seem to locate this framework.
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to How to use SWIFTUI and SWIFT language to call com port?
I don't know if this is still an issue for you but you have the choice of calling C, Objective-C, and now C++ directly from Swift. See what's new in Swift from WWDC23. There is a sample here that will allow you to enumerate serial devices on macOS. That might be a useful place to start. I would place this code in a separate framework and write the appropriate wrapper functions (as needed) to invoke them from SwiftUI or Swift. If you are trying this on iPadOS, forget it. The sample code won't compile for iOS since most of the definitions are missing or not made public for serial device support in IOKit. I was able to test this code with an FT232(USB-C to UART) board and it worked well enough. Also, you can use Serial Tools to make sure the device you want to talk to is supported by the default drivers built into macOS.
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to DriverKit Support on USB-C iPhones
Same deal. I need to support custom hardware via USB-C and serial communication. We are currently trying to figure out the iPad (started three days ago; slow going), the iPhone is next on the list.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Unable to link to or even find USBDriverKit for iPadOS
Thank you for your response.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to How to use Swift and AVFoundation to stream/record USB microphone input?
Trial & error coupled with scouring the web has yielded at least a partial answer: import AVFoundation import Cocoa import PlaygroundSupport PlaygroundPage.current.needsIndefiniteExecution = true let engine = AVAudioEngine() let inputNode = engine.inputNode let format = inputNode.inputFormat(forBus: 0) let outputNode = engine.outputNode engine.connect(inputNode, to: outputNode, format: format) //var bufferCount = 0 //input.installTap(onBus: 0, bufferSize: 2048, format: nil) { audioBuffer, audioTime in // bufferCount += 1 // print(bufferCount) //} engine.prepare() do { try engine.start() } catch { print(error) } Ridiculously simple but amazingly difficult to stumble upon. At least, that was my experience. Next, I need a way to enumerate the inputs so I can pick the microphone I want to use. Anyone have a clue on how that is accomplished on macOS? During my time researching this problem, I noticed that things are much easier and much better documented for iOS.
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to Settings bundle for DEXT loading app does not display content.
Ignore the API call I listed in the initial post. That is for macOS not iPadOS. I actually support both platforms but the issue I'm having is with the iPad. There we simply launch the settings app using the following technique: extension ExtensionManager { func activate() { guard let url = URL(string: UIApplication.openSettingsURLString) else { return } UIApplication.shared.open(url) } func deactivate() { } }
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to Settings bundle for DEXT loading app does not display content.
The iPad I'm trying to use is not an M1 or M2 iPad, which is a requirement for the DriverKit extensions. I have the generation just prior to the M1 iPad.
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to Core Animation Layer in SwiftUI app does not update unless I rotate the device.
Solved. Must call setNeedsDisplay from the main thread.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’24
Reply to Lack of Vendor ID for “USB transport" entitlement and Can't find "userclient-access" for AppID
I have the same question with regard to the USB transport entitlement. I've added my vendor id to the appropriate entitlement files but my binary fails validation when trying to upload it to the store for distribution. The embeded.mobileprovision file in the generated archive shows an asterisk instead of my approved Vendor ID. How can I make sure the embedded provisioning file has my Vendor ID?
Topic: Code Signing SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’24
Reply to DriverKit: embedded.mobileprofile has the wildcard USB Vendor ID instead of my assigned Vendor ID
Kevin, thank you so much for responding. My entire dev team just got together on a video call and spent 3 hours trying everything we could to figure this out. No personal reflection on you but Apple MUST do better. The information you provided above jives with most of what we discovered. The solution for us was to switch to automatic and also change the idVendor value from a String to a Number when moving from an wildcard value to a literal value. This appears to be necessary when putting a real Vendor ID in the entitlements file. This was a lot harder than it should have been.
Replies
Boosts
Views
Activity
May ’24
Reply to How does one create a provisioning profile for embedded DEXT for iPhoneOS that is signed with a distribution cert?
This problem has been solved. Please see this thread for details. https://developer.apple.com/forums/thread/751490
Replies
Boosts
Views
Activity
May ’24