【发布时间】:2018-04-19 04:45:36
【问题描述】:
当我打电话给UIApplication.shared.setStatusBarOrientation(.landscapeRight, animated: true)
应用程序进入后台并返回,打印
“ApplicationWillResignActive”
“ApplicationDidBecomeActive”
“ApplicationWillResignActive”
“ApplicationDidBecomeActive”
为什么?我只有两个动作
@objc fileprivate func handleApplicationWillResignActive() {
debugPrint("ApplicationWillResignActive")
if self.playerPlayStatus == .playing {
self.currentPlayTime = self.player.currentTime()
self.player.pause()
}
}
@objc fileprivate func handleApplicationDidBecomeActive() {
debugPrint("ApplicationDidBecomeActive")
switch self.playerPlayStatus {
case .pause:
self.player.seek(to: self.currentPlayTime, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero, completionHandler: { (finished) in
if finished {
self.player.play()
}
})
default: break
}
}
【问题讨论】:
-
显示你尝试过的代码
-
我认为这是苹果创建的错误?虽然我调用了已弃用的函数
标签: ios swift notifications