-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashes immediately on MIDI event (or, what am I missing) #214
Comments
Do you mind zipping up your project and sending it to me (andrew@openreelsoftware.com)? What you've described should work. I don't have a MIDI device handy to test with the moment, but will later tonight. |
I was able to reproduce this. The problem here is that the However, you need a little more than that to actually receive events. Try this: class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let connectionManager = MIKMIDIConnectionManager(name: "test")
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
connectionManager.eventHandler = { (source, messages) in
print("Received MIDI messages: \(messages)")
}
return true
}
} |
The crash you saw should be fixed in master, but you'll still need to make sure you keep a strong reference to the connection manager (e.g. using a property as in my example code above) in order to actually receive events. |
Αh, thanks. Weak references always catch me out 😞 |
I created an empty Swift project, and in
AppDelegate.application(_:didFinishLaunchingWithOptions:)
added_ = MIKMIDIConnectionManager(name: "test")
. That's it. As soon as the first MIDI event comes in the app crashes withEXC_BAD_ACCESS
. I did wonder if it was #213, but I can reproduce in 1.6.2 and master.Since I've no idea what I'm doing here, what's the absolute minimum I need to set up to start receiving MIDI events? Do I need
MIKMIDIConnectionManager
? Should registering the delegate be enough?Is there an example project (in Swift!) anywhere?
The text was updated successfully, but these errors were encountered: