gpt4 book ai didi

ios - WatchKit WKInterfaceMovie fatal error : unexpectedly found nil while unwrapping an Optional value

转载 作者:行者123 更新时间:2023-11-30 13:53:24 25 4
gpt4 key购买 nike

import WatchKit
import Foundation


class InterfaceController: WKInterfaceController {

let video = NSBundle.mainBundle().URLForResource("video", withExtension: "mp4")

@IBOutlet var videoShown: WKInterfaceMovie!

override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)

// Configure interface objects here.
videoShown.setMovieURL(video!)
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}

}

我的代码如上所示,我尝试使用 WKInterfaceMovie 在 WatchKit 应用程序上播放位于 XCode 资源文件夹中的视频,但在应用程序加载时出现此错误:

fatal error: unexpectedly found nil while unwrapping an Optional value

最佳答案

问题可能出在您的视频位置。将文件复制到“WatchKit Extension”文件夹中,而不是复制到 Assets 文件夹中。

关于ios - WatchKit WKInterfaceMovie fatal error : unexpectedly found nil while unwrapping an Optional value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33972393/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com