swift - 隐式可选仅在 iPad 模拟器中崩溃。意外发现零
问题描述
我的应用程序在 iphone 模拟器中运行良好,但一旦我将其切换到 iPad,它就会崩溃。我使用的是拆分视图,主视图是一个表格控制器,它进入包含视频和标签的详细视图。
(如果我需要详细说明我的拆分视图控制器,请告诉我。)
我尝试了两种“字符串(描述:)”来消除此警告并提供默认设置,但无济于事。
我不知道如何打开这样的东西。
override func viewDidLoad() {
super.viewDidLoad()
let videoName = signs.signName.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
//not working in ipad view. crashes. Probably because not every sign has a video yet?
let httpsReference = Storage.storage().reference(forURL: "https://firebasestorage.googleapis.com/v0/b/lasdictionaryv2.appspot.com/o/\(videoName!).mov")
//may need to get rid of force unwrap. because thats not safe. but not sure how.
httpsReference.downloadURL() { url, error in
print("URL",url as Any)
print("ERROR", error as Any)
if let url = url, error == nil {
self.videoView.configureForUrl(url)
self.videoView.isLoop = true
self.videoView.play()
}
}
}
我希望 ipad 模拟器能像 iphone 一样工作。
解决方案
推荐阅读
- python - 我的程序在检测单词中的特定字母时遇到问题
- python - 如何在python中执行能够在文本文件中显示前10个关键字的程序
- reactjs - React Hooks:获取数据后初始化本地状态
- oracle - 将大型 SQL 表转储为 .csv 并将其拆分为多个单独的 CSV 用于 Redshift
- python - 将 3D 数组重塑为 2D 数组以生成 DataFrame:跟踪索引以生成列名
- matlab - 将向量拆分为预定义大小的组
- npm - inso cli安装失败
- shell - 如何使用 sed 命令用特殊字符 (',') 替换新行
- angular - Angular Material Stepper 可重复使用的表单,具有单独的步骤作为组件
- python - Python在字符串中切片两次