简体   繁体   English

MidiClientCreate“操作无法完成。 (OSStatus错误-50。)”

[英]MidiClientCreate “The operation couldn't be completed. (OSStatus error -50.)”

I'm trying to debug a MIDI issue in a complex iOS / Objective-C software. 我正在尝试在复杂的iOS / Objective-C软件中调试MIDI问题。 It appears on this call : 它出现在此通话中:

OSStatus s;
MIDIClientRef midi_client_ref;
s = MIDIClientCreate((CFStringRef)@"MIDIPlayerSetup MIDI Client", NULL, NULL,
                     &midi_client_ref);

Most of the time everything works fine but sometimes the returned OSStatus is a -50 code (bad parameter). 大多数情况下,一切正常,但有时返回的OSStatus是-50代码(错误的参数)。

But as you can see and like in many example of MIDIClientCreate on the web, the explicit parameters can't really be the problem. 但是,正如您在网上看到的MIDIClientCreate的许多示例中所看到的那样,显式参数并不是真正的问题。 I even tried to have an unique name with no effect. 我什至试图拥有一个唯一的名称,但没有任何效果。

To orientate my search, I would need to have a more precise idea of what is going on in the underlying client creation that could provoke this bad parameter issue. 为了确定搜索方向,我需要对底层客户端创建中可能引起此错误参数问题的内容有一个更精确的了解。

Any guess is welcome ! 任何猜测都欢迎!

UPDATE : someone got the same issue here and solved it. 更新:有人在这里遇到相同的问题并解决了。 He says "It was caused by an uninitalised variable.". 他说:“这是由未初始化的变量引起的。”

That's an indication, but not enough to lead me to my mistake... 这只是一个指示,但不足以使我误入歧途...

I contacted Apple and this is an internal CoreMIDI bug (until iOS8.3 at least) that was unknown until now. 我联系了苹果公司,这是一个内部CoreMIDI错误(至少到iOS8.3),直到现在才知道。

From the support : 来自支持:

MIDIClientCreate itself will return -50 in only two scenarios: MIDIClientCreate本身将仅在两种情况下返回-50:

1) If outClient itself is NULL so in the above you forget to take the address of client. 1)如果outClient本身为NULL,那么在上面您会忘记获取客户端的地址。

2) If the MIDI server has an issue getting a process ID back internally 2)如果MIDI服务器在内部获取进程ID时遇到问题

I ensured the address of the client I provide is ok so in my case that is 2). 我确保我提供的客户地址可以,因此在我的情况下是2)。

Reproducting the bug : 重现该错误:

I then noticed that I had several calls to MIDIGetNumberOfSources(); 然后我注意到我对MIDIGetNumberOfSources();进行了多次调用MIDIGetNumberOfSources(); before the potential bug, so I implemented a sample app with in its delegate : 在潜在错误发生之前,所以我在其委托中实现了一个示例应用程序:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSLog(@"application:didFinishLaunchingWithOptions:");
    for (int i = 0; i < 100000000; i++) {
        MIDIGetNumberOfSources();
    }
    MIDIClientRef client;
    OSStatus s = MIDIClientCreate(CFSTR("iMIDI Client"), NULL, NULL, &client);
    NSLog(@"OSStatus : %d", (int)s);
    return YES;
}

Running the app on iPhone 5 in iOS Simulator with iOS 8.3 (12F69) gives about 50% chances to reproduce the bug each time on my machine. 在装有iOS 8.3(12F69)的iOS Simulator中的iPhone 5上运行该应用程序,每次在我的计算机上重现该错误的机会约为50%。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS 5.0 AVAudioPlayer加载音频片段时出错:无法完成该操作。 (OSStatus错误-50。) - iOS 5.0 AVAudioPlayer Error loading audio clip: The operation couldn’t be completed. (OSStatus error -50.) 操作无法完成。 (OSStatus 错误 -54。) - The operation couldn’t be completed. (OSStatus error -54.) 该操作无法完成。 (OSStatus错误-10827。) - The operation couldn’t be completed. (OSStatus error -10827.) 操作无法完成。 (OSStatus 错误 2003334207。) - The Operation Couldn’t Be Completed. (OSStatus Error 2003334207.) “comgooglemaps://” - 错误:“操作无法完成。 (OSStatus错误-10814。)“ - “comgooglemaps://” - error: “The operation couldn’t be completed. (OSStatus error -10814.)” -canOpenURL:URL 失败:“fbauth2:/” - 错误:“操作无法完成。(OSStatus 错误 -10814。) - -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.) 音频播放器错误:操作无法完成。 (OSStatus 错误 2003334207。) - audioPlayer error: The operation couldn’t be completed. (OSStatus error 2003334207.) SKSMTPMessage错误-无法完成该操作。(OSStatus错误-9807。) - SKSMTPMessage Error- The operation couldn't be completed.(OSStatus error -9807.) AVAudioPlayer失败,并显示错误“操作无法完成。 (OSStatus错误2003334207。)” - AVAudioPlayer fails with error “The operation couldn’t be completed. (OSStatus error 2003334207.)” 操作无法完成。 (OSStatus 错误 -600。)无法在模拟器中运行应用程序 - The operation couldn’t be completed. (OSStatus error -600.) Cant run app in simulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM