I'm programatically adding a intro video for my app. Im getting the following warnings. any ideas what I'm doing wrong? Im very new to swift and iOS development.
2018-04-19 13:11:56.295952+0200 [1779:395252] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "", "", " (active, names: '|':UIStackView:0x15dd29110 )>", "", " (active, names: '|':UIStackView:0x15dd29110 )>" )
Will attempt to recover by breaking constraint
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful. 2018-04-19 13:11:56.296790+0200 [1779:395252] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "", "", "", "UILayoutGuide:0x1d41bd180'UIViewLayoutMarginsGuide'
(active, names: '|':UIStackView:0x15dd29110 )>", " (active, names: '|':UIStackView:0x15dd29110 )>" )Will attempt to recover by breaking constraint
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful.
var movieController: AVPlayer?
let playerViewController = AVPlayerViewController()
override func viewDidLoad() {
playVideo()
}
func playVideo() {
let path = Bundle.main.path(forResource: appData.videoFile, ofType: appData.videoExtension)
let url = URL(fileURLWithPath: path!)
movieController = AVPlayer(url: url)
NotificationCenter.default.addObserver(self, selector:#selector(movieFinished),name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: movieController?.currentItem)
playerViewController.player = self.movieController
playerViewController.delegate = self
playerViewController.view.frame = self.view.bounds
playerViewController.showsPlaybackControls = false
playerViewController.videoGravity = "AVLayerVideoGravityResizeAspectFill"
playerViewController.view.translatesAutoresizingMaskIntoConstraints = false
playerViewController.player?.play()
self.view.addSubview(playerViewController.view)
}
@objc func movieFinished() {
let value = UIInterfaceOrientation.portrait.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
UIViewController.attemptRotationToDeviceOrientation()
UIView.animate(withDuration: 1.5, delay: 0, options: .curveEaseIn, animations: {
self.playerViewController.view.alpha = 0.0
}, completion: { (finished: Bool) in
self.playerViewController.view.removeFromSuperview()
})
}