Post

Replies

Boosts

Views

Created

IOUSBHostPipe::IO hangs on data greater than 256 bytes
We are developing driver for our USB device. We've implemented commutation using IOUSBHostPipe::IO and it perfectly works for data packets that less than 256 bytes. However it hangs when reply from USB device is about 512 bytes. We see 0x2ed // device not responding error when we unplug our device and driver is stopped. Here is our code for setup: constexpr uint32_t kOutEndpointAddress = 1; constexpr uint32_t kInEndpointAddress = 129; constexpr uint16_t kBufferSize = 256; ..... struct ForcePlateDriver_IVars { ....     IOUSBHostPipe            *inPipe;     IOBufferMemoryDescriptor *inData;     uint16_t                  maxPacketSize; }; .....     ret = ivars->interface->CopyPipe(kInEndpointAddress, &ivars->inPipe);     ret = ivars->interface->CreateIOBuffer(kIOMemoryDirectionIn,                                            ivars->maxPacketSize,                                            &ivars->inData); We use following code for reading data from USB device:     uint32_t bytesTransferred = 0;     ret = ivars->inPipe->IO(                             ivars->inData,                             ivars->maxPacketSize,                             &bytesTransferred,                             0); What we tried: Increase kBufferSize to 512 but drive still hangs Change 0 to 2000 (timeout) for inPipe->IO method. Result method returns - 0x2d6(// I/O Timeout)
1
4
1.2k
Sep ’22
Can't get Driver properties using IORegistryEntryCreateCFProperties on iPadOS 16.1
We are developing our Driver using DriverKit. In client App we successfully discover our driver but can't get IORegistry properties except IOClass. So in a client App we use following code to read properties:     private func debugRegistry(device: io_object_t) {         var dictionary: Unmanaged<CFMutableDictionary>?         IORegistryEntryCreateCFProperties(device, &dictionary, kCFAllocatorDefault, .zero)         if let dictionary = dictionary {             let values = dictionary.takeUnretainedValue()             print(values)         }     } output is: {     IOClass = IOUserService; } We tested same code on macOS and output contains about 20+ properties. It looks like IOKi doesn't allow to read other properties except IOClass. Environment: Xcode - Version 14.1 beta 2 (14B5024i). iPadOS - iOS 16.1 (20B5050f)
1
1
1.1k
Sep ’22
How to get distribution entitlements for DriverKit on iPadOS?
We got development entitlement for our Driver that we requested here: https://developer.apple.com/contact/request/system-extension/ Next we tested our Driver on test devices and now want to upload build into TestFlight. But it looks like we need distribution version of same entitlements. Where we can request them? BTW, Apple Docs: Requesting Entitlements for DriverKit Development describe only development approach. It would be good to add instructions for Distribution as well.
6
2
1.3k
Oct ’22
DriverKit: Check that driver is enabled on iPadOS
Apple Docs mentions that driver should be approved(enabled) in Settings app. I wonder is there any API available to check that driver is not enabled? To my mind, App with driver should have a following flow: Run App Check that driver is(not) enabled Display message(alert) and ask to enable driver in Settings. Optionally: provide shortcut to exact Settings page Unfortunately, it's not obvious how to check that driver is enabled.
3
0
1.4k
Nov ’22
Open UIApplication.openSettingsURLString doesn't navigate to App's settings
We are building iPadOS App that uses bundled DriveKit driver to communicate with USB device. This bundled driver should be enabled first by user from App's settings or Privacy & Security page. We read in Apple Docs that openSettingsURLString is recommended way to navigate user to App's settings. We added alert that is shown on App launch and has option to open settings. Our solution perfectly works on local DEBUG build. So user is navigated to App's settings when he click "Open Settings". However it doesn't work for TestFlight/App Store builds. "Open Settings" just opens system Settings app on some random page. Code: let settingsURL = URL(string: UIApplication.openSettingsURLString)! UIApplication.shared.open(settingsURL) Environment: Xcode Version 14.1(14B47b) iPadOS 16.1.1(20B101) Note: Our Settings.bundle contains Root.plist with no custom settings: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict/> </plist> We read speculations that some permission request should be triggered before navigation. Unfortunately, there is no API that checks or requests permission for DriverKit in the moment.
0
1
1.2k
Dec ’22
Xcode 14.3: Missing code coverage for private variables in SwiftUI views
We are experiencing missing coverage for private variables in SwiftUI views after update from Xcode 14.3 to Xcode 14.2. Steps to reproduce: Create new SwiftUI project in Xcode Enable code coverage Modify ContentView to struct ContentView: View { private let title = "Hello, world!" let text: String var body: some View { VStack { Text(title) Text(text) } .padding() } } Run UITest - CoverageTestTests::testExample Check coverage in Xcode for ContentView Actual result: Line private let title = "Hello, world!" is not covered. Expected result: Line should be covered Workaround: Generate initialiser for ContentView init(text: String) { self.text = text } Coverage is correct when initialiser is added explicitly Test project: https://github.com/yuri-qualtie/CoverageTest
1
3
1.1k
Apr ’23
XCUIElement's click is broken in iOS 17 simulator
Based on official docs click is available for iPadOS apps. We utilized click action to create universal UITests for macOS and iPadOS targets. It works fine on iPadOS 16.x but, unfortunately, stops to work in iOS 17 simulators for iPad. Environment: MacOS - 13.5.2 (22G91). Xcode - Version 15.0 (15A240d). Simulator - Version 15.0 (1015.2). SimulatorKit 935.1. CoreSimulator 920.6. Steps to reproduce: Create new multiplatform app Add simple button. For example: struct ContentView: View { @State var title = "Click Me" var body: some View { VStack { Button(title) { title = "Clicked" } .background(Color.blue) .foregroundColor(.white) } .padding() } } Add UITest that clicks on button. For example: func testClick() throws { let app = XCUIApplication() app.launch() app.buttons["Click Me"].click() XCTAssertTrue(app.buttons["Clicked"].exists) } Expected result: test is passed Actual result: test is failed since buttons["Click Me"].click() doesn't click in button. Workaround: Replacement .click() to .tap() fixes the issue but it makes impossible to create universal tests with single action for both platforms
0
2
568
Oct ’23
LazyVStack produces `AttributeGraph: cycle detected through attribute` when used in sheet
struct SheetView: View { @Binding var showSheet: Bool var body: some View { LazyVStack { Button("Dismiss") { showSheet.toggle() } } } } struct ContentView: View { @State private var showSheet = false var body: some View { Button("Show") { showSheet.toggle() } .sheet(isPresented: $showSheet) { SheetView(showSheet: $showSheet) } } } Xcode displays === AttributeGraph: cycle detected through attribute 119104 === message in console when SheetView is presented on screen. Environment: macOS 14.4.1 Xcode: Version 15.2
1
2
618
Apr ’24
macOS Sequoia doesn't respect Full Disk Access for UITests-Runner
We develop and test App for macOS. We start to see system alert - "UlTests-Runner" would like to access data from other apps on each UITest run. Our test suite does cleanup of files generated by App so we need access outside of UITests-Runner sandbox. We enabled Full Disk Access for UITests-Runner at Settings -> Privacy & Security -> Full Disk Access but unfortunately still see this alert. Is there any way to permanently remove/hide this alert or remove sandbox for 'UITests-Runner' since we want to run tests on CI and having this alert is not an option? Note: everything works fine on previous versions of macOS. Environment: macOS - 15.1 (24B83) Xcode - Version 16.1 (16B40)
0
1
467
Nov ’24