Enabling MIDINetworkSession defaultSession on a newly set up device fails on first run

Originator:kiiwep
Number:rdar://18690017 Date Originated:17-Oct-2014 04:21 PM
Status:Open Resolved:
Product:iOS Product Version:7.1.2, 8.0.2, 8.1
Classification:Other Reproducible:Always
 
Summary:
If you have a newly setup device or one that has been reset, the first call to
[MIDINetworkSession defaultSession].enabled = YES;
won't take effect, the session won't be enabled. If you query the value of the property you will find it to be false. If you restart the application and try to enable the session again it will succeed, as will every other attempt until you reset the device again.

Steps to Reproduce:
Reset an iOS device, then start an application that wants to enable the [MIDINetworkSession defaultSession].

Consider the following example:

MIDIClientRef client;
MIDIPortRef inputPort;
MIDIClientCreate(CFSTR("Client"), NULL, NULL, &client);
MIDIInputPortCreate(client, CFSTR("Input Port"), NULL, NULL, &inputPort);
        MIDIPortConnectSource(inputPort, [MIDINetworkSession defaultSession].sourceEndpoint, NULL);

[MIDINetworkSession defaultSession].enabled = YES;
NSLog(@"Status: %d", [MIDINetworkSession defaultSession].enabled);

In this example I omitted the callback functions, but thats not relevant here.

Expected Results:
To be able to enable the defaultSession at the first try.

Actual Results:
If you run the provided example on a device where the defaultSession was not enabled previously (it's a newly setup device or was reset, or no MIDI application was used before) you won't be able to enable the session. The code will run, the port will open, but the app won't be able to communicate.

If you restart the app however, and in fact from that point on you can successfully enable the session until again you reset the devices settings.

Version:
iOS 7.1.2, iOS 8.0.2, iOS 8.1

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!