Repository navigation
Unable to connect to HID reply port using FBSimulatorControl framework #525
Description
Activity
The
HIDobject can't be created until the Simulator is booted.If you want to access this, use the
connectToHIDmethod onFBSimulatorinstead, this should ensure that all the invariants are met. For the most part, you'll not need to create instances of most helper classes yourself, they are all exposed onFBSimulator.@lawrencelomax I used the
connectToHIDmethod as suggested. I was able to get theHIDobject. But I was unable to obtain the reply port.The registration port was
14671.
It failed to connect to the reply port. It produced an error.The console log was
[Error] Failed to get the Indigo Reply Port 268451843func bootSimulator() throws { let bootOptions = FBSimulatorBootOptions.enableDirectLaunch let bootConfiguration = FBSimulatorBootConfiguration.default.withScale(scale).withOptions(bootOptions) if sim?.state != .booted { let simBootFuture = sim?.boot(with: bootConfiguration) simBootFuture?.onQueue(.main, notifyOfCompletion: { (simBoot) in }) do { try simBootFuture?.await() } catch let bootError { print("[Error] Failed to boot simulator \(sim!.udid) because \(bootError.localizedDescription)") throw bootError } } do { let simConFut = sim?.connect() simConFut?.onQueue(DispatchQueue.main, notifyOfCompletion: { (simConFuture) in }) try simConFut?.await() simCon = simConFut?.result let simHIDFuture = self.simCon?.connectToHID() simHIDFuture?.onQueue(.main, notifyOfCompletion: { (simHIDFut) in }) try simHIDFuture?.await() self.simHID = simHIDFuture?.result let hidConnectFuture = self.simHID?.connect() hidConnectFuture?.onQueue(.main, notifyOfCompletion: { (hidConnectFut) in }) try hidConnectFuture?.await() _ = hidConnectFuture?.result } catch let hidConnectError{ print("[Error] \(hidConnectError.localizedDescription)") throw hidConnectError } }Can you make sure that
SimulatorKitis loaded by usingFBSimulatorControlFrameworkLoader.xcodeFrameworks.loadPrivateFrameworksOrAbortbefore any of the calls?I think your code is taking an old code path that might not work on newer versions of xcode.
I have tried in different machines. The result seems to be same. Used
FBSimulatorControlFrameworkLoader.xcodeFrameworks.loadPrivateFrameworksOrAbort. The path seems to be fine. Still the HID registration port is connected but the reply port is not getting registered
Using FBSimulatorControl in a CLI to control multiple simulators and I am not able to register HID port
Description
I am launching the device in
direct launchmode. I am able to create the simulator. I am creating the HID, and then boot the simulator. But then when I try to connect the HID port, it fails. The error shows the port has not been registeredReproduction
The console will print
[Error] HID reply port failed to connect to simulator 04B6D540-3E5A-4343-AEEE-4DE9B40B56DA because Cannot connect when there is no registration portCan anyone please let me know what I am missing out?