how to determine in applicationDidBecomeActive whether it is the initial iPhone app launch?

前端 未结 3 459
再見小時候
再見小時候 2021-02-08 18:15

how to determine in how to determine in UIApplicationDidBecomeActiveNotification whether it is the initial app launch?whether it is the initial app launch?

that is the i

3条回答
  •  爱一瞬间的悲伤
    2021-02-08 19:06

    I used to use the method mentioned by @XJones. Then I realized it has a potential issue: if "the initial app launch" means to check in applicationDidBecomeActive whether it was called the first time since the app was launched! Because when app was relaunching the app (either through springboard, app switching or URL) all the above 3 delegate method will be called! So the safest way is to reset self.activatedFromBackground in applicationDidBecomeActive.

提交回复
热议问题