我正在尝试在后台播放视频。我的代码如下:
import UIKit
class ViewController: VideoSplashViewController {
override func viewDidLoad() {
super.viewDidLoad()
let path = NSBundle.mainBundle().pathForResource("test", ofType: "m4a")
let url = NSURL(fileURLWithPath:path!)
self.videoFrame = view.frame
self.fillMode = .ResizeAspectFill
self.alwaysRepeat = true
self.sound = true
self.startTime = 12.0
self.duration = 4.0
self.alpha = 0.7
self.backgroundColor = UIColor.blackColor()
self.content
网址=网址
我得到的错误是:
可选类型的值'字符串?'没有打开;你的意思是用吗? '!'或者'?'?
答案 0 :(得分:-1)
我看到你的代码应该有效。但是,如果await SomeNetworkCallAsync(); // call, wait and forget the result
确定它不是零,则在末尾添加“Optional type
”以打开或使用“!
”。对于这样的问题,首先应该搜索,这太基础了。