小编Yar*_*ika的帖子

AVAudioPlayer不再适用于Swift 2.0/Xcode 7 beta

对于var testAudio我的iPhone应用程序中的声明,我在这里收到错误

"调用可以抛出,但错误不能从属性初始化程序中抛出"

import UIKit
import AVFoundation
class ViewController: UIViewController {
    var testAudio = AVAudioPlayer(contentsOfURL: NSURL (fileURLWithPath: NSBundle.mainBundle().pathForResource("testAudio", ofType: "wav")!), fileTypeHint:nil)
Run Code Online (Sandbox Code Playgroud)

当我转到Xcode 7测试版时,就发生了这种情况.

如何在Swift 2.0中使用此音频剪辑?

beta xcode ios xcode7

6
推荐指数
1
解决办法
7778
查看次数

标签 统计

beta ×1

ios ×1

xcode ×1

xcode7 ×1