无法调用非功能类型的值' AVAudioPlayer'

时间:2016-07-14 03:27:46

标签: swift

我一直在查看我的卡片,似乎无法找到问题所在。这是代码。

@IBAction func PlayAudio(sender: AnyObject) {
    let AVAudioPlayer = ButtonAudioPlayer{
        ButtonAudioPlayer.play()
}

它只是抛出错误,表示"不能调用非功能类型的值' AVAudioPlayer'"

1 个答案:

答案 0 :(得分:-1)

您正尝试将private native void socketWrite0(FileDescriptor fd, byte[] b, int off, int len) throws IOException; /** * Writes to the socket with appropriate locking of the * FileDescriptor. * @param b the data to be written * @param off the start offset in the data * @param len the number of bytes that are written * @exception IOException If an I/O error has occurred. */ private void socketWrite(byte b[], int off, int len) throws IOException { if (len <= 0 || off < 0 || off + len > b.length) { if (len == 0) { return; } throw new ArrayIndexOutOfBoundsException(); } FileDescriptor fd = impl.acquireFD(); try { socketWrite0(fd, b, off, len); } catch (SocketException se) { if (se instanceof sun.net.ConnectionResetException) { impl.setConnectionResetPending(); se = new SocketException("Connection reset"); } if (impl.isClosedOrPending()) { throw new SocketException("Socket closed"); } else { throw se; } } finally { impl.releaseFD(); } } (大写)用作常量名称。该名称is already defined as a class

更像是:

AVAudioPlayer

也许你的意思是这样的?

let myAudioPlayer = ButtonAudioPlayer{
    ButtonAudioPlayer.play()
    // etc.