Can't start workable Simulator instance without mach_port/register-head-services
| Originator: | mars.martian | ||
| Number: | rdar://24410474 | Date Originated: | 1/29/2016 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | |
| Classification: | Reproducible: |
Summary:
While SimDeviceFramebufferService is incredibly useful, there is still some magical incantations to get it working that IMO, should be incorporated into SimDevice. Notably:
@"register-head-services" must be passed as options to [SimDevice bootWithOptions:error:] in order for a SimDeviceFramebufferService created prior to actually be used. This seems pretty counter-intuitive, as you would expect creating SimDeviceFramebufferService while passing in the device would handle hooking into it at boot time.
Furthermore, in order for backboardd to work with the Indigo HID system, you must register a service with @"IndigoHIDRegistrationPort" on the SimDevice before starting. This also requires creating a mach port which, while not technically difficult, is a bit tedious. It also seems like everyone using the SimDevice API to boot a simulator would expect events to be handled as normally. (Though I'm sure there are a couple cases where you would want access to this mach port, so maybe it could be exposed as well.)
Steps to Reproduce:
Our code looks something like:
[SimDeviceFramebufferService mainScreenFramebufferServiceForDevice:simulator.device error:&error];
mach_port_t hidPort = 0;
mach_port_t machTask = mach_task_self();
kern_return_t result = mach_port_allocate(machTask, MACH_PORT_RIGHT_RECEIVE, &hidPort);
if (result != KERN_SUCCESS) {
..
}
result = mach_port_insert_right(machTask, hidPort, hidPort, MACH_MSG_TYPE_MAKE_SEND);
if (result != KERN_SUCCESS) {
..
}
if (![simulator.device registerPort:hidPort service:@"IndigoHIDRegistrationPort" error:&innerError]) {
..
}
NSDictionary *options = @{
@"register-head-services" : @YES
};
BOOL success = [simulator.device bootWithOptions:options error:&error];
Expected Results:
.
Actual Results:
.
Version:
.
Notes:
Configuration:
Xcode 7.2 (7C68)
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!