ボタンを押すと音楽が流れるアプリを練習で開発しています。
以下のコードを書いたのですが、太字部分でエラーが出てしいます。原因がわかる方教えていただければ幸いです。
import UIKit
import AVFoundation
class ViewController: UIViewController {
**var practiceSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource(“TwinkleLittleStar″, ofType: “mp3″)!)** var practicePlayer = AVAudioPlayer() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. practicePlayer = AVAudioPlayer(contentsOfURL: practiceSound, error: nil) practicePlayer.prepareToPlay() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func TwinkleLittleStar(sender: UIButton) { practicePlayer.currentTime = 0 practicePlayer.play() }
}
なお、エラーの内容は
Unicode curly quote found,replace with ""
Expected ',' separator
の2つです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/11/12 16:51