位DailyMotion播放机不处于UIWebView中夫特3
问题描述:
我已经写在Xcode 9.将以下代码的ID变量来自我的另一个视图控制器工作,经由SEGUE。位DailyMotion播放机不处于UIWebView中夫特3
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "ID" {
if let indexPath = self.tblview.indexPathForSelectedRow {
let controller = segue.destination as! DViewController
let value = arrRes[indexPath.row]
controller.videoId = value["id"] as! String
}
}
class DViewController : UIViewController {
@IBOutlet weak var Views: UIWebView!
var ID : String!
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "https://www.dailymotion.com/embed/video/\(ID)?sharing-enable=0&ui-logo=0&endscreen-enable=0&autoplay=1")
Views.loadRequest(URLRequest(url: url!))
Views.allowsInlineMediaPlayback = true
}
}
}
当我运行代码,我得到以下错误:
Page not found. The page you're looking for is ... restricted ...
答
你得到错误,因为找不到页面。尝试在浏览器中进入该页面。该link you put in your code返回404
页,换句话说,它不会去任何地方有意义。你的代码看起来很好;这是断开的链接。
你开始尝试调试代码之前,再想想为什么它可能无法正常工作的最简单的可能的解释。通常最简单的解释是正确的解释。在这种情况下,该错误消息说,这一切 - 页面无法找到。那里什么都没有。