In Xcode 11 beta 6's iOS 13 simulators I'm getting a crash when enabling the MIDI Network Session.
I was able to replicate by adding the following lines to AppDelegate's didFinishLaunching:WithOptions:
in a fresh project:
MIDINetworkSession.default().isEnabled = true
MIDINetworkSession.default().connectionPolicy = .anyone
When run in an iOS 13 simulator the app will crash at the first of these lines, printing "Couldn't find MIDI network driver" to the console. iOS 12 and earlier simulators are unaffected.
Strangely though it seems that not all of my iOS 13 simulators are affected. It seems that any iOS 13 simulators I had used from Xcode 11 beta 4 and earlier work correctly. The only simulators affected may be ones I used for the first time in Xcode 11 beta 5 onwards.
I'm assuming this is a beta software bug, and have already filed the bug with Apple. But I felt it smart to document here in case anyone else comes across it.
Update: 2019-09-11
This is still a problem for me with the simulators in the Xcode 11.0 GM seed (including the new iPhone 11 models).
Update: 2019-09-30
Issue still exists in Xcode 11.1 GM seed. I followed the steps in Evan's answer and that appeared to fix it.
I was getting the same error as you and this frusturated me. I searched for a solution for four days, and finally found one. I hope this will help you as well! Please follow these steps carefully:
Update Xcode to the latest version
Make sure your build target deployment version is set to iOS 13.0
Quit the applications Simulator and Xcode if they are open
Using Finder, navigate to the folder which your version of Xcode is located (mine is in my Applications folder)
Control + click on Xcode, and select 'Show Package Contents'
Navigate to /Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime
Control + click on 'iOS.simruntime', and select 'Show Package Contents'
Navigate to /Contents/MacOS
and verify you see a document named 'iOS 13.0'
Exit out of the 'MacOS' folder back to the 'Contents' folder and Navigate to /Resources/RuntimeRoot/System/Library/Audio
Copy the entire 'MIDI Drivers' folder
Exit out of the 'Audio' folder and navigate all the way back to the 'RuntimeRoot' folder
Navigate to /Library/Audio
and you should see there is no folder called 'MIDI Drivers' here, only 'Plug-Ins' and 'Tunings'
Paste the 'MIDI Drivers' folder you copied into this 'Audio' folder
Close Finder, relaunch Xcode and try running your project again in the iOS 13 simulator
Now, Xcode should not complain about missing the MIDI Drivers, and your code should run without the EXE_BAD_ACCESS! I hope this helps, and please feel free to reach out to me if you have any more questions.
This is just a simplification of the accepted answer, since I do this often. Assuming your Xcode is in /Applications/Xcode.app
:
Copy MIDI Drivers
from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Audio
to
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Library/Audio
and relaunch Xcode.
Note
So it's present in RuntimeRoot/System/Library/Audio
and needs to be in RuntimeRoot/Library/Audio
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With