c# - MonoMac/Xamarin.Mac : EntryPointNotFoundException for AudioSession. 初始化()

标签 c# macos mono xamarin monomac

我对 C#、MonoMac 和 Xamarin 非常陌生,正在尝试使用 this awesome example 播放一些使用 C# 和 Xamarin.Mac 生成的音频。 .

不幸的是第一行:

AudioSession.Initialize();

抛出EntryPointNotFoundException

我偶然发现了this forum post有人遇到类似的问题并表明它与不正确的绑定(bind)有关。

我真的可以让它发挥作用吗?如果没有,我可以用什么代替?

非常感谢您的帮助。

我的系统

Xamarin.Mac: 1.2.43

Xamarin.Studio Version 4.0.3 (build 13)

Mono 2.10.12 (mono-2-10/c9b270d)

GTK 2.24.16

GTK# (2.12.0.0)

Package version: 210120000

堆栈跟踪

System.EntryPointNotFoundException: AudioSessionInitialize
  at at (wrapper managed-to-native) MonoMac.AudioToolbox.AudioSession.AudioSessionInitialize (intptr,intptr,MonoMac.AudioToolbox.AudioSession/InterruptionListener,intptr) <IL 0x00011, 0x0007b>
  at MonoMac.AudioToolbox.AudioSession.Initialize (MonoMac.CoreFoundation.CFRunLoop,string) [0x00013] in /Users/builder/data/lanes/xamcore-lion-bs1/0c83ca0e/source/xamcore/maccore/src/AudioToolbox/AudioSession.cs:225

最佳答案

我认为 OS X 上不使用 AudioSession。

您正在使用的示例代码可能适用于 iOS。

如果您检查 documentation对于 AudioSession,您将看到:

These functions apply only to iOS. They do not apply to Mac OS X.

此外,请参阅此 discussion 。 AudioSession 根本不可用,这就是为什么在尝试调用它时会收到 EntryPointNotFoundException...

关于c# - MonoMac/Xamarin.Mac : EntryPointNotFoundException for AudioSession. 初始化(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15799092/

相关文章:

c# - 从方法中删除多余的泛型参数

linux - Linux 上的 NuGet : Error getting response stream

mono - 从哪里下载已编译并准备好在 Windows 下使用 MonoDev for Mono 2?

swift - 无法使用 macOS 填充 xib 创建的 swift tableView

macos - 如何用 cocoa 中的4个点制作矩形?对于可调整大小的矩形

asp.net-mvc - 使用 Mono 和 MVC 4 的 View 出现错误

c# - 分离excel多行选择

javascript - 允许链接在 Bot 的弹出窗口中打开

C# VS 2008 构建配置——对不同的构建使用不同的类

cocoa - NSUrlRequest : where an app can find the default headers for HTTP request?