gpt4 book ai didi

ios - 当我更改 statusBarOrientation 时应用程序生命周期错误

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

当我调用UIApplication.shared.setStatusBarOrientation(.landscapeRight,animated: true)

应用程序进入后台并返回,打印

“ApplicationWillResignActive”

“应用程序已变为事件状态”

“ApplicationWillResignActive”

“应用程序已变为事件状态”

为什么?我只有两个 Action

@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
}
}

最佳答案

ApplicationWillResignActive 和Background 都是不同的东西。即使是前台应用程序中的应用程序也可能变为非事件状态。所以请简单介绍一下,你想做什么?

关于ios - 当我更改 statusBarOrientation 时应用程序生命周期错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49912901/

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