ios - 检测 iOS 版本的最佳位置(方法)在哪里?

标签 ios appdelegate

搜索时没有看到它,如果我错过了,请深表歉意,但我很好奇检测 iOS 版本的最佳位置。我看到很多关于如何操作的帖子,但我想知道最好的检查地点是哪里。

didFinishLaunchingWithOptions 是有道理的,但我的问题是,如果用户启动您的应用程序,点击主页按钮,升级他们的 iOS 版本,然后再次打开应用程序怎么办?是再次调用 didFinishLaunchingWithOptions 还是只是正常的进入前台方法?这是我能想到的一个案例,didFinishLaunchingWithOptions 可能会让您失望。

最佳答案

如前所述,这是一种相当罕见的情况,但如果您真的需要在每次打开应用程序时都进行检查;无论是处于后台还是处于非事件状态,您都可以将版本检测连接到:

- (void)applicationDidBecomeActive:(UIApplication *)application

如果您有兴趣了解有关启动生命周期的更多信息以及在哪些点调用哪些应用程序委托(delegate)方法,请参阅 UIApplicationDelegate documentation .

关于ios - 检测 iOS 版本的最佳位置(方法)在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20225282/

相关文章:

ios - 快速更改 AppDelegate 中的初始 View Controller

iphone - SDImageCache - imageFromMemoryCache 返回 nil

ios - 检查是否单击了注释标注

ios - 动画标签栏。 swift

ios - 从 Web 下载图像或 mp3 文件到 iPhone 文档目录

ios - Alamofire 请求的进度

ios - 从 AppDelegate 到 PresentedViewController 的警报 : "Attempt to present UIAlertController on ... whitch is already presenting UIAlertController"

swift - 如何在 Swift 中处理 launchOptions : [NSObject: AnyObject]??

ios - 通过 Appdelegate 调用时展开 View Controller 时出错

ios - 类消息的接收方“SMClient”是前向声明