Describe the bug
Apple broke the iOS Simulator support with Xcode 12.5:
[Error]: Could not get port for name: 'com.apple.iphonesimulator.bridge.1339'
Further research shows that the
-(char)findServiceInSession:(void *)arg2 serviceName:(void *)arg3 servicePort:(unsigned int *)arg4 error:(void * *)arg5
method of SimLaunchHostClient fails. I assume Apple somehow disallows accessing the port from inside a sandboxed process or renamed the port ? Which leads to the questions:
Does it help to remove the sandbox ?
No, I tried.
How does Xcode do it ?
How does Facebooks idb do it ?
Turns out Facebooks idb currently does not support the Simulator bridge in Xcode 12.5. Keep an eye on https://github.com/facebook/idb. I assume Apple somehow changed how the simulator bridge port is named.
Solution
It seem like SimDevice now implements the setLocationWithLatitude:andLongitude:error: method. It is therefore no longer necessary to obtain a bridge connection. The solution is therefore:
Add a isConnected attribute
For Xcode 12.4 set the variable to _bridge != NULL for 12.5 set it to true for each device and set it to false when terminating the simulator / the simulator instance was closed
Check if SimDevice implements setLocationWithLatitude:andLongitude:error: inside of - (BOOL)setLocationWithLatitude:(double)latitude andLongitude:(double)longitude
Either delegate the call to the bridge or call the method directly
Implement the reset location by using clearSimulatedLocationWithError: for Xcode 12.5
We can not map the pid to SimDevice anymore. Try to use the bootStatus to detect if the simulator for this specific device was shut down
To Reproduce
Try to find a Simulator device.
Expected behavior
The Simulator device is detected.
Notes
Seems like Apple removed the SimulatorBridge executable ?. If this is the case it is no wonder, that nothing is working anymore.
Describe the bug Apple broke the iOS Simulator support with Xcode 12.5:
[Error]: Could not get port for name: 'com.apple.iphonesimulator.bridge.1339'
Further research shows that the
method of
SimLaunchHostClient
fails. I assume Apple somehow disallows accessing the port from inside a sandboxed process or renamed the port ? Which leads to the questions:Solution It seem like
SimDevice
now implements thesetLocationWithLatitude:andLongitude:error:
method. It is therefore no longer necessary to obtain a bridge connection. The solution is therefore:isConnected
attribute_bridge != NULL
for 12.5 set it totrue
for each device and set it tofalse
when terminating the simulator / the simulator instance was closedSimDevice
implementssetLocationWithLatitude:andLongitude:error:
inside of- (BOOL)setLocationWithLatitude:(double)latitude andLongitude:(double)longitude
clearSimulatedLocationWithError:
for Xcode 12.5To Reproduce Try to find a Simulator device.
Expected behavior The Simulator device is detected.
Notes Seems like Apple removed the
SimulatorBridge
executable ?. If this is the case it is no wonder, that nothing is working anymore.