之前我确实问过这个问题并得到了答案但我在设备上运行时仍然收到相同的错误消息。
此应用程序正在从后台线程修改autolayout引擎,这可能导致引擎损坏和奇怪的崩溃。这将在将来的版本中导致异常。堆栈:(
我正在运行的代码位于
之下import UIKit
class BallPitchingViewController: UIViewController {
@IBOutlet weak var videoView: UIWebView!
var time = NSTimer.scheduledTimerWithTimeInterval(2, target: self, selector: "load", userInfo: nil, repeats: false)
func load() {
let youTubeUrl = "https://www.youtube.com/embed/behrfv14zX0"
videoView.allowsInlineMediaPlayback = true
self.videoView.loadHTMLString("<iframe width=\"\(self.videoView.frame.width)\" height=\"\(self.videoView.frame.height)\" src=\"\(youTubeUrl)\" frameborder=\"0\" allowfullscreen></iframe>", baseURL: nil)
print("This is run on the main queue, after the previous code in outer block")
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func viewDidAppear(animated: Bool)
{
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}